Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stack limit in ASan builds #778

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ endif()

if(CONFIG_UBSAN)
message(STATUS "Building with UBSan")
# __has_feature(undefined_sanitizer) or __SANITIZE_UNDEFINED__ don't exist
add_compile_definitions(
__UBSAN__=1
)
add_compile_options(
-fsanitize=undefined
-fno-sanitize-recover=all
Expand Down
8 changes: 0 additions & 8 deletions cutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ extern "C" {
#include <pthread.h>
#endif

#if defined(__SANITIZE_ADDRESS__)
# define __ASAN__ 1
#elif defined(__has_feature)
# if __has_feature(address_sanitizer)
# define __ASAN__ 1
# endif
#endif

#if defined(_MSC_VER) && !defined(__clang__)
# define likely(x) (x)
# define unlikely(x) (x)
Expand Down
3 changes: 0 additions & 3 deletions qjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ static const JSCFunctionListEntry navigator_proto_funcs[] = {

static const JSCFunctionListEntry global_obj[] = {
JS_CFUNC_DEF("gc", 0, js_gc),
#if defined(__ASAN__) || defined(__UBSAN__)
JS_PROP_INT32_DEF("__running_with_sanitizer__", 1, JS_PROP_C_W_E ),
#endif
};

/* also used to initialize the worker context */
Expand Down
2 changes: 1 addition & 1 deletion quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2517,7 +2517,7 @@ JSRuntime *JS_GetRuntime(JSContext *ctx)

static void update_stack_limit(JSRuntime *rt)
{
#if defined(__wasi__) || (defined(__ASAN__) && !defined(NDEBUG))
#if defined(__wasi__)
rt->stack_limit = 0; /* no limit */
#else
if (rt->stack_size == 0) {
Expand Down
7 changes: 7 additions & 0 deletions tests/bug775.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*---
negative:
phase: runtime
type: RangeError
---*/
function f() { f() } // was problematic under ASan
f()
7 changes: 7 additions & 0 deletions tests/bug776.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*---
negative:
phase: runtime
type: RangeError
---*/
function f() { f.apply(null) } // was problematic under ASan
f()
2 changes: 0 additions & 2 deletions tests/test_std.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,6 @@ function test_timeout()

function test_timeout_order()
{
if (globalThis.__running_with_sanitizer__) return;

var s = "";
os.setTimeout(a, 0);
os.setTimeout(b, 100);
Expand Down
Loading