Skip to content

Commit 99c02eb

Browse files
authored
Update stack limit in ASan builds (#778)
Otherwise recursive calls keep going until they trip ASan checks. Remove the `__ASAN__` and `__UBSAN__` defines; no longer necessary. Remove `globalThis.__running_with_sanitizer__` from qjs; likewise. Fixes: #671 Fixes: #775 Fixes: #776
1 parent 74fd4d7 commit 99c02eb

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ endif()
165165

166166
if(CONFIG_UBSAN)
167167
message(STATUS "Building with UBSan")
168-
# __has_feature(undefined_sanitizer) or __SANITIZE_UNDEFINED__ don't exist
169-
add_compile_definitions(
170-
__UBSAN__=1
171-
)
172168
add_compile_options(
173169
-fsanitize=undefined
174170
-fno-sanitize-recover=all

cutils.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ extern "C" {
5454
#include <pthread.h>
5555
#endif
5656

57-
#if defined(__SANITIZE_ADDRESS__)
58-
# define __ASAN__ 1
59-
#elif defined(__has_feature)
60-
# if __has_feature(address_sanitizer)
61-
# define __ASAN__ 1
62-
# endif
63-
#endif
64-
6557
#if defined(_MSC_VER) && !defined(__clang__)
6658
# define likely(x) (x)
6759
# define unlikely(x) (x)

qjs.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,6 @@ static const JSCFunctionListEntry navigator_proto_funcs[] = {
208208

209209
static const JSCFunctionListEntry global_obj[] = {
210210
JS_CFUNC_DEF("gc", 0, js_gc),
211-
#if defined(__ASAN__) || defined(__UBSAN__)
212-
JS_PROP_INT32_DEF("__running_with_sanitizer__", 1, JS_PROP_C_W_E ),
213-
#endif
214211
};
215212

216213
/* also used to initialize the worker context */

quickjs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,7 @@ JSRuntime *JS_GetRuntime(JSContext *ctx)
25172517

25182518
static void update_stack_limit(JSRuntime *rt)
25192519
{
2520-
#if defined(__wasi__) || (defined(__ASAN__) && !defined(NDEBUG))
2520+
#if defined(__wasi__)
25212521
rt->stack_limit = 0; /* no limit */
25222522
#else
25232523
if (rt->stack_size == 0) {

tests/bug775.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*---
2+
negative:
3+
phase: runtime
4+
type: RangeError
5+
---*/
6+
function f() { f() } // was problematic under ASan
7+
f()

tests/bug776.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*---
2+
negative:
3+
phase: runtime
4+
type: RangeError
5+
---*/
6+
function f() { f.apply(null) } // was problematic under ASan
7+
f()

tests/test_std.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,6 @@ function test_timeout()
258258

259259
function test_timeout_order()
260260
{
261-
if (globalThis.__running_with_sanitizer__) return;
262-
263261
var s = "";
264262
os.setTimeout(a, 0);
265263
os.setTimeout(b, 100);

0 commit comments

Comments
 (0)