Merge "Inline __libc_init_global_stack_chk_guard."

This commit is contained in:
Treehugger Robot 2018-05-31 02:22:06 +00:00 committed by Gerrit Code Review
commit 6ef8415d09

View file

@ -42,10 +42,6 @@ extern "C" int __set_tid_address(int* tid_address);
// Declared in "private/bionic_ssp.h".
uintptr_t __stack_chk_guard = 0;
void __libc_init_global_stack_chk_guard(KernelArgumentBlock& args) {
__libc_safe_arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard), args);
}
// Setup for the main thread. For dynamic executables, this is called by the
// linker _before_ libc is mapped in memory. This means that all writes to
// globals from this function will apply to linker-private copies and will not
@ -96,7 +92,7 @@ void __libc_init_main_thread(KernelArgumentBlock& args) {
// The TLS stack guard is set from the global, so ensure that we've initialized the global
// before we initialize the TLS. Dynamic executables will initialize their copy of the global
// stack protector from the one in the main thread's TLS.
__libc_init_global_stack_chk_guard(args);
__libc_safe_arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard), args);
__init_thread_stack_guard(&main_thread);
__init_thread(&main_thread);