Tracking PR for 14.0 EN for: commit 4c9a0adad18263ec8725d9bfc5f560c6ad1da8bd Author: Dimitry Andric <dim@FreeBSD.org> Date: Wed Nov 22 19:23:06 2023 +0100 compiler-rt: avoid segfaults when re-exec'ing with ASLR After 930a7c2ac67e ("compiler-rt: re-exec with ASLR disabled when necessary") and 96fe7c8ab0f6 ("compiler-rt: support ReExec() on FreeBSD"), binaries linked against the sanitizer libraries may segfault due to procctl(2) being intercepted. Instead, the non-intercepted internal_procctl() should be called. Similarly, the ReExec() function that re-executes the binary after turning off ASLR should not call elf_aux_info(3) and realpath(3), since these will also be intercepted. Instead, loop directly over the elf aux info vector to find the executable path, and avoid calling realpath(3) since it is actually unwanted for this use case. Fixes: 930a7c2ac67e, 96fe7c8ab0f6 MFC after: 3 days
MFCd: https://cgit.freebsd.org/src/commit/?h=stable/14&id=1e4798e9677f17a7cdc9a1873a0c6e008fc620d8 https://cgit.freebsd.org/src/commit/?h=stable/13&id=7c25a53a2cb975e516cfea78898bfb850db88524
All MFCs apparently committed.
(In reply to Mark Linimon from comment #2) This is a tracking PR for an EN to address this in 14.0
Right, the intent is to close this once the EN is released, hopefully quite soon.
I cannot reproduce a problem on FreeBSD 13.2, which has LLVM 14.0.5. This predates intercepting procctl, which was added in https://github.com/llvm/llvm-project/commit/c06ef17359efcab643c09ba54fa1381ea184986d
Fixed by FreeBSD-EN-23:15.sanitizer.
Created attachment 246752 [details] patch for 13
(In reply to Ed Maste from comment #7) Yes, that patch LGTM.