Page MenuHomeFreeBSD

update __stack_chk_guard safely
AbandonedPublic

Authored by lffpires_ruabrasil.org on Apr 26 2018, 12:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 10, 4:10 AM
Unknown Object (File)
Nov 27 2025, 3:06 AM
Unknown Object (File)
Nov 26 2025, 12:05 AM
Unknown Object (File)
Nov 25 2025, 5:14 AM
Unknown Object (File)
Nov 24 2025, 4:48 PM
Unknown Object (File)
Nov 21 2025, 5:12 PM
Unknown Object (File)
Nov 20 2025, 5:44 PM
Unknown Object (File)
Nov 20 2025, 4:35 PM

Details

Reviewers
kib
Summary

This is necessary to make sure that functions that can have stack protection are not used to update the stack guard.
In that case, the stack guard check would fail when it shouldn't.

This fixes in libexec the same issue that was fixed in libc in D15173.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16312
Build 16253: arc lint + arc unit

Event Timeline

I think this is more involved than just avoiding memcpy(). If you look at the libexec/rtld-elf/Makefile near the start, you would see MK_SSP=no. In other words, we know that rtld must be compiled without stack protector, but you effectively point out that libc_pic.a is compiled with it, and this causes more troubles.

I suggest to consider changing the build for libc_pic.a to also avoid -fstack-protector instead of fixing the single place.

In D15208#320453, @kib wrote:

I think this is more involved than just avoiding memcpy(). If you look at the libexec/rtld-elf/Makefile near the start, you would see MK_SSP=no. In other words, we know that rtld must be compiled without stack protector, but you effectively point out that libc_pic.a is compiled with it, and this causes more troubles.

I suggest to consider changing the build for libc_pic.a to also avoid -fstack-protector instead of fixing the single place.

@kib, I submitted another revision (D15283) to address this. Please let me know your comments.

This revision can be discarded.