diff options
author | Andrew Kaster <andrewdkaster@gmail.com> | 2021-05-23 19:40:22 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-27 15:18:03 +0200 |
commit | 4a5a1e864894a2d3ac80fdf061a34f5e6a29abfb (patch) | |
tree | 8e33a4f87838764c0b8df85a3065def5e0037ced /Userland/Libraries/LibC | |
parent | 505f84daae62ff6b0c94eb2551fd69e87e56823f (diff) | |
download | serenity-4a5a1e864894a2d3ac80fdf061a34f5e6a29abfb.zip |
Userland: Port UBSAN implementation to userspace
Take Kernel/UBSanitizer.cpp and make a copy in LibSanitizer.
We can use LibSanitizer to hold other sanitizers as people implement
them :^).
To enable UBSAN for LibC, DynamicLoader, and other low level system
libraries, LibUBSanitizer is built as a serenity_libc, and has a static
version for LibCStatic to use. The approach is the same as that taken in
Note that this means now UBSAN is enabled for code generators, Lagom,
Kernel, and Userspace with -DENABLE_UNDEFINED_SANTIZER=ON. In userspace
however, UBSAN is not deadly (yet).
Co-authored-by: ForLoveOfCats <ForLoveOfCats@vivaldi.net>
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r-- | Userland/Libraries/LibC/CMakeLists.txt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/CMakeLists.txt b/Userland/Libraries/LibC/CMakeLists.txt index 9df1b2a559..f5d9722bc7 100644 --- a/Userland/Libraries/LibC/CMakeLists.txt +++ b/Userland/Libraries/LibC/CMakeLists.txt @@ -95,15 +95,16 @@ set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES} ${ASM_SOURCES}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++") add_library(LibCStaticWithoutDeps STATIC ${SOURCES}) target_link_libraries(LibCStaticWithoutDeps ssp) -add_dependencies(LibCStaticWithoutDeps LibM LibSystem) +add_dependencies(LibCStaticWithoutDeps LibM LibSystem LibUBSanitizer) add_custom_target(LibCStatic COMMAND ${CMAKE_AR} -x $<TARGET_FILE:LibCStaticWithoutDeps> COMMAND ${CMAKE_AR} -x $<TARGET_FILE:ssp> COMMAND ${CMAKE_AR} -x $<TARGET_FILE:LibSystemStatic> + COMMAND ${CMAKE_AR} -x $<TARGET_FILE:LibUBSanitizerStatic> COMMAND ${CMAKE_AR} -qcs ${CMAKE_CURRENT_BINARY_DIR}/libc.a *.o WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS LibCStaticWithoutDeps ssp LibSystemStatic + DEPENDS LibCStaticWithoutDeps ssp LibSystemStatic LibUBSanitizerStatic ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libc.a DESTINATION ${CMAKE_INSTALL_PREFIX}/usr/lib/) |