The hackery is due to glibc clock_gettime crashing from preinit_array (D40679).
32-bit musl architectures do not define __NR_clock_gettime so the code causes a compile error.
Tested on Alpine Linux x86-64 (musl) and FreeBSD x86-64.
Paths
| Differential D96925
[sanitizer] Restrict clock_gettime workaround to glibc ClosedPublic Authored by MaskRay on Feb 17 2021, 7:04 PM.
Details Summary The hackery is due to glibc clock_gettime crashing from preinit_array (D40679). Tested on Alpine Linux x86-64 (musl) and FreeBSD x86-64.
Diff Detail
Event TimelineHerald added subscribers: pengfei, fedor.sergeev, krytarowski and 2 others. · View Herald TranscriptFeb 17 2021, 7:04 PM Comment Actions Trivial test which just call the function from preinit array and do not crash would be nice This revision is now accepted and ready to land.Mar 5 2021, 12:16 PM Comment Actions
This (clock_gettime in .preinit_array time) has been tested by scudo tests (D40679). @cryptoad Perhaps we can delete these blocks once the minimum supported glibc does not need these. Hope this patch makes these places stand out. This revision was landed with ongoing or failed builds.Mar 6 2021, 10:32 AM Closed by commit rGca747e48afa0: [sanitizer] Restrict clock_gettime workaround to glibc (authored by MaskRay). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 328782 compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/lib/sanitizer_common/sanitizer_linux.h
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
|