From 317ceb0ee22ee4bceaad97773082a425f0694a94 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 22 Nov 2021 19:18:34 +0100 Subject: [PATCH] LibSystem: Disable stack protector in syscall wrappers on i686 This is a hack to avoid a circular dependency issue with the stack check failure handler being in LibC. This is not ideal, and there's most likely a better way to solve this. That said, LibSystem should not have anything but thin wrappers around system calls, so stack protectors have limited utility here anyway. --- Userland/Libraries/LibSystem/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibSystem/CMakeLists.txt b/Userland/Libraries/LibSystem/CMakeLists.txt index c45501ad18..a376338226 100644 --- a/Userland/Libraries/LibSystem/CMakeLists.txt +++ b/Userland/Libraries/LibSystem/CMakeLists.txt @@ -3,6 +3,11 @@ set(SOURCES syscall.cpp ) +# FIXME: This is a hack to avoid a circular dependency with LibC. Figure out a better way. +if ("${SERENITY_ARCH}" STREQUAL "i686") + set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS "-fno-stack-protector") +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib") serenity_libc(LibSystem system) target_include_directories(LibSystem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})