-
Notifications
You must be signed in to change notification settings - Fork 0
#21 call asan on setjmp #22
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -218,7 +218,15 @@ struct lua_longjmp { | |
| # define LUA_ASMNAME(x) _##x | ||
| #endif | ||
|
|
||
| #if LUA_ARCH_X86_64 | ||
| /* | ||
| ** Under AddressSanitizer, use system setjmp/longjmp so ASAN can | ||
| ** intercept them and properly unpoison skipped stack frames. | ||
| ** The custom asm versions bypass ASAN and cause false positives. | ||
| */ | ||
| #if defined(__SANITIZE_ADDRESS__) | ||
| # define lua_do_setjmp setjmp | ||
| # define lua_do_longjmp longjmp | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ASAN path incorrectly triggers extern declarations for setjmpMedium Severity When Additional Locations (1)Reviewed by Cursor Bugbot for commit 18b1507. Configure here. |
||
| #elif LUA_ARCH_X86_64 | ||
| # define lua_do_setjmp LUA_ASMNAME(lua_setjmp_amd64) | ||
| # define lua_do_longjmp LUA_ASMNAME(lua_longjmp_amd64) | ||
| #elif LUA_ARCH_I386 | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASAN detection misses Clang before version 21
Low Severity
The ASAN check uses only
__SANITIZE_ADDRESS__, which GCC has supported since 4.8 but Clang only added in version 21 (2026). Clang versions before 21 use__has_feature(address_sanitizer)instead. Builds with older Clang and-fsanitize=addresswill silently skip this block and continue using the custom asmsetjmp/longjmp, defeating the purpose of the ASAN fix. The common portable pattern checks both:defined(__SANITIZE_ADDRESS__) || (defined(__has_feature) && __has_feature(address_sanitizer)).Reviewed by Cursor Bugbot for commit 27c45ad. Configure here.