If SANITIZER_CAN_USE_PREINIT_ARRAY=0 interceptors or cfi callbacks can be called
before constructor.
Details
Diff Detail
- Build Status
Buildable 15377 Build 15377: arc lint + arc unit
Event Timeline
compiler-rt/lib/cfi/cfi.cc | ||
---|---|---|
428 | This mutex is not very useful. An interceptor could still go ahead while cfi_init is running in another thread. And we probably can not afford a lock in cfi_slowpath. Perhaps add a constructor to all cfi-instrumented binaries? Then we would not need lazy initialization in __cfi_slowpath, and I don't care how many locks dlopen() takes. |
A constructor would also mitigate the dlopen issue (see the comment before the interceptor). Not that we've seen this issue in the wild.
As discussed offline, I going to keep primary initialization unchanged and make lazy only interceptors initialization.
compiler-rt/lib/cfi/cfi.cc | ||
---|---|---|
416 | I see, that's too early for that. |
This is technically a data race. Let's just take a lock, this is not performance sensitive.