mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
The shared parts are now firmly compiled into LibC instead of being defined as a static library and then being copied over manually. The non-shared ("local") parts are kept as a static library that is linked into each binary on demand. This finally allows us to support linking with the -fstack-protector flag, which now replaces the `ssp` target being linked into each binary accidentally via CMake.
31 lines
805 B
C++
31 lines
805 B
C++
/*
|
|
* Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <AK/Format.h>
|
|
#include <AK/Types.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/internals.h>
|
|
#include <unistd.h>
|
|
|
|
#if defined __SSP__ || defined __SSP_ALL__
|
|
# error "file must not be compiled with stack protection enabled on it. Use -fno-stack-protector"
|
|
#endif
|
|
|
|
extern "C" {
|
|
|
|
extern size_t __stack_chk_guard;
|
|
__attribute__((used)) size_t __stack_chk_guard = (size_t)0xc6c7c8c9;
|
|
|
|
__attribute__((noreturn)) void __stack_chk_fail()
|
|
{
|
|
dbgln("Error: USERSPACE({}) Stack protector failure, stack smashing detected!", getpid());
|
|
if (__stdio_is_initialized)
|
|
warnln("Error: Stack protector failure, stack smashing detected!");
|
|
abort();
|
|
}
|
|
|
|
} // extern "C"
|