History log of /haiku/src/system/libroot/os/stack_protector.cpp
Revision Date Author Comments
# 7bfc9c6f 16-Apr-2023 Trung Nguyen <trungnt282910@gmail.com>

libroot: Fix bad pointer access in __init_stack_protector

The address of the variable should be taken instead of the
variable itself being casted to `void*`.

This fixes a rare segfault bug when any Haiku binary runs in
a `chroot`ed environment without a `/dev` mount.

Change-Id: I2fdacac62fadbcce8006bbf0a5350f6ec95133ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6377
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 857c79a6 09-Oct-2021 Adrien Destugues <pulkomandy@pulkomandy.tk>

Introduce symbol_visibility.h with macros to define hidden functions

These were used in function_remapper.cpp but can be used elsewhere too,
so move them to a private header. Also use them for the stack protector
hidden function definition (probably not so useful since gcc2 doesn't
support using the stack protector anyway?).

The gcc2 way to make a symbol hidden is to manually generate the .hidden
directive in the assembler output. This is not perfect: it is hard to
use for C++ functions and methods (manual mangling of the name is
needed), and inline assembler can only be inserted inside functions. But
the alternative is patching gcc2 to add support for the function
attribute, and I don't want to dig into that today.


# 04be20a7 01-May-2021 Jérôme Duval <jerome.duval@gmail.com>

Implement stack protection support

this adds kernel & libroot stack protector hooks. it uses /dev/random in userspace.
A configure option --enable-stack-protector is added to activate -fstack-protector
on selected system components (ATM apps, kits, servers).

Change-Id: If3a2920ba9aa0a85eaff4ba6778947f8c76ade31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3895
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>