We have to avoid calling renameat2 and clone on FreeBSD.
Additionally, the mcontext structure has different members.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | ||
---|---|---|
1345 | x86_64, i386 and arm currently have this, but aarch64, mips and powerpc64 do not. Should we not just hoist an #if SANITIZER_LINUX out around the whole thing so we don't need N copies of the same thing? | |
1909 | This whole code is overly complex on FreeBSD. On Linux's it's needed because (for whatever reason, probably because it copied MIPS) the exception info isn't available. On FreeBSD you can just inspect gp_sstatus and see if it's a load or store/amo page/access fault, like is done for Arm and AArch64. |
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | ||
---|---|---|
1909 | ... never mind, that's sstatus, not scause. How sad, and what a weird field to expose, there's nothing you can usefully do with it from userspace. Maybe we should break ABI and replace it with gp_scause... nobody should be using it at the moment. |
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | ||
---|---|---|
1345 | I considered adding it around the whole block, but then decided to keep the diff as small as possible instead. Happy to change that though |
LGTM.
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | ||
---|---|---|
1345 | @jrtc27's suggestion makes sense. Please commit an updated patch. | |
1909 |
That would be nice. The current approach is always going to be brittle. Plus, IIRC it's not even being directly unit-tested. Was your suggestion to change the ABI only for FreeBSD, though? |
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp | ||
---|---|---|
1909 | It should be doable on Linux too in the same way that it's done for AArch64 I would imagine, i.e. tacking an extra list of variable length extension structs on the end. They probably won't be so willing to break ABI :) (in FreeBSD breaking ABI is ok if you have good justification and it's not a Tier 1 architecture) |
clang-format: please reformat the code