[compiler-rt] Revert "[safestack] Various Solaris fixes" (PR #98541)
Rainer Orth via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 15 05:38:50 PDT 2024
rorth wrote:
Dealing with `__sanitizer_internal_memset` turns out to be more involved than I hoped: when I added stub versions of `__sanitizer_internal_mem*` to `safestack.cpp`, testing went fine on all of Solaris/sparcv9, Solaris/amd64, and Linux/x86_64 (32 and 64-bit each). However, Linux/sparc64 was different: while 64-bit was ok as well, 32-bit aborted in a call to `__sanitizer_internal_memset` in the `pthread_create` interceptor. Here's what I found:
- `safestack.cpp` is compiled with `-ftrivial-auto-var-init=pattern` (which isn't documented in the clang manual AFAICT).
- This causes `tmpattr` in the `pthread_create` interceptor to be initialized to `-1`. On most targets, this is done inline: Solaris `pthread_attr_init` is `sizeof(void *)` so this is trivial, while on Linux it's way larger (36 bytes for 32-bit, 56-bytes for 64-bit). Only on 32-bit Linux/sparc, this is done with a call to `memset` which ultimately results in the failing call to `__sanitizer_internal_memset`.
It seems the safestack developers have just been lucky (or lazy) here.
I wonder how to deal with this: just add a copy of `__sanitizer_internal_mem*` to `safestack.cpp` to cope?
https://github.com/llvm/llvm-project/pull/98541
More information about the llvm-commits
mailing list