Skip to content

Commit

Permalink
ASAN fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Oct 18, 2023
1 parent 86cbb60 commit 2e17bb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dlload.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ JL_DLLEXPORT JL_NO_SANITIZE void *jl_dlopen(const char *filename, unsigned flags
dlopen = (dlopen_prototype*)dlsym(RTLD_NEXT, "dlopen");
if (!dlopen)
return NULL;
void *libdl_handle = dlopen("libdl.so", RTLD_NOW | RTLD_NOLOAD);
void *libdl_handle = dlopen("libdl.so.2", RTLD_NOW | RTLD_NOLOAD);
assert(libdl_handle);
dlopen = (dlopen_prototype*)dlsym(libdl_handle, "dlopen");
dlclose(libdl_handle);
Expand Down
5 changes: 5 additions & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -2159,9 +2159,14 @@ void (ijl_longjmp)(jmp_buf _Buf, int _Value);
#define jl_setjmp(a,b) sigsetjmp(a,b)
#if defined(_COMPILER_ASAN_ENABLED_) && __GLIBC__
// Bypass the ASAN longjmp wrapper - we're unpoisoning the stack ourselves.
#if !__GLIBC_PREREQ(2, 34)
JL_DLLIMPORT int __attribute__ ((nothrow)) (__libc_siglongjmp)(jl_jmp_buf buf, int val);
#define jl_longjmp(a,b) __libc_siglongjmp(a,b)
#else
// This broke with glibc 2.34, where the __libc_siglongjmp symbol was removed
#define jl_longjmp(a,b) siglongjmp(a,b)
#endif
#else
#define jl_longjmp(a,b) siglongjmp(a,b)
#endif
#endif
Expand Down

0 comments on commit 2e17bb5

Please sign in to comment.