1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 08:47:35 +00:00

LibELF+Userland: Enable RELRO for all userland executables :^)

The dynamic loader will now mark RELRO segments read-only after
performing relocations. This is pretty cool!

Note that this only applies to main executables so far,.
RELRO support for shared libraries will require some reorganizing
of the dynamic loader.
This commit is contained in:
Andreas Kling 2021-02-18 18:43:20 +01:00
parent 0d3866e84c
commit fa4c249425
4 changed files with 32 additions and 2 deletions

View file

@ -147,7 +147,7 @@ endforeach()
set(CMAKE_INSTALL_NAME_TOOL "")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,--hash-style=gnu")
set(CMAKE_CXX_LINK_FLAGS "-Wl,--hash-style=gnu")
set(CMAKE_CXX_LINK_FLAGS "-Wl,--hash-style=gnu,-z,relro,-z,now")
# We disable it completely because it makes cmake very spammy.
# This will need to be revisited when the Loader supports RPATH/RUN_PATH.