]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
compiler-rt: avoid segfaults when re-exec'ing with ASLR
authorDimitry Andric <dim@FreeBSD.org>
Wed, 22 Nov 2023 18:23:06 +0000 (19:23 +0100)
committerEd Maste <emaste@FreeBSD.org>
Tue, 5 Dec 2023 18:20:00 +0000 (13:20 -0500)
commit6d94fc2b0db9c2f0b0d5b116513d745122bc37c4
tree6eb943694909bd04ffdc918538b0d8198d8218b1
parent08225c10315a038983baea3e0dd3009fda068ac5
compiler-rt: avoid segfaults when re-exec'ing with ASLR

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: 930a7c2ac67e96fe7c8ab0f6

(cherry picked from commit 4c9a0adad18263ec8725d9bfc5f560c6ad1da8bd)
(cherry picked from commit 7c25a53a2cb975e516cfea78898bfb850db88524)

Note: This is a partial cherry-pick, as only the ReExec change from the
original applies to FreeBSD 13.2.

Security: EN-23:15.sanitizer
Approved by: so
contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp