Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Sanitizers should work for aarch64, we have build bot for that
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | Do we need to change sanitizer_internal_defs.h |
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | If anything, we need to change this file. This change only affects 32-bit PowerPC. |
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | !defined(x86_64) is reasonable. Though the exact condition in sanitizer_internal_defs.h is complicated: https://github.com/llvm/llvm-project/blob/5e2f4dc37b1bf72bd27e929a68fec18ae1f5cfa8/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h#L175 plus https://github.com/llvm/llvm-project/blob/5e2f4dc37b1bf72bd27e929a68fec18ae1f5cfa8/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h#L134 for uptr. This change actually should only affect powerpc64 -- ARCH_PPC is an google internally defined macro so this is always false in the wild. |
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | That makes sense! The other branch of the definition for "OFF_T" in sanitizer_internal_defs.h is the following: And uptr is defined to be "unsigned long" for non-64-bit Windows: #if defined(_WIN64) // 64-bit Windows uses LLP64 data model. typedef unsigned long long uptr; typedef signed long long sptr; #else typedef unsigned long uptr; typedef signed long sptr; #endif // defined(_WIN64) So how about updating to "!defined(x86_64) && !defined(_WIN64)"? Verified that this is working for Diorite imc/acc. Are there other tests that you think would be necessary to run? |
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | SGTM |
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | Why are there !defined(x86_64) or ARCH_PPC special cases? ELF platforms can exclusively use {,unsigned} long. (signed can be omitted.) |
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | According to the original commit https://github.com/llvm/llvm-project/commit/f0b8f989e93fa4a07a320c7cf54ac859bf9c164e WARNING: OFF_T may be different from OS type off_t, depending on the value of |
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | There are two different OFF_T definitions. In sanitizer_wrapper.cpp, it is expected to be an 64-bit integer on ELF32 (regardless of _FILE_OFFSET_BITS). In sanitizer_internal_defs.h, it is expected to be an 32-bit integer on ELF32 (regardless of _FILE_OFFSET_BITS). We probably should use OFF64_T for internal_mmap and ideally unify the two OFF_T definitions. OFF64_T is because we want to make 32-bit -D_FILE_OFFSET_BITS=64 platforms work. |
compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp | ||
---|---|---|
21–22 | Looks we now have two options for fixing the bug. @vitalybuka @eugenis Do you have a preference on how to proceed? |
OFF_T magic is about matching libc.so ABI in the interceptors.
internal_mmap does not have to deal with it, and it can simply use uptr for the offset argument, unless I'm missing something.
updated definition in sanitizer_linux.cpp to use u64 as the type for offset and updated internal_mmap in sanitizer_wrappers.cpp to use "unsigned long long" directly.
u64 is unconditionally typedef unsigned long long u64; so using unsigned long long in sanitizer_wrappers.cpp should be fine.
Do we need to change sanitizer_internal_defs.h