HomeFreeBSD

Carefully update stack guard bytes inside __guard_setup().

Description

Carefully update stack guard bytes inside __guard_setup().

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

guard_setup() calls elf_aux_info(), which, in turn, calls memcpy() to
update stack_chk_guard. If either elf_aux_info() or memcpy() have
stack protection enabled, __stack_chk_guard will be modified before
returning from them, causing the stack protection check to fail.

This change uses a temporary buffer to delay changing
__stack_chk_guard until elf_aux_info() returns.

Submitted by: Luis Pires
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D15173

Details

Provenance
kibAuthored on
Differential Revision
D15173: udpate stack guard bytes inside __guard_setup()
Parents
rS332939: MFC r332364:
Branches
Unknown
Tags
Unknown