mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Allow turning on multiple sanitizers (#611)
Consolidate the ASan and UBSan buildbots and turn on both sanitizers when fuzzing.
This commit is contained in:
parent
966dbfc1f9
commit
bed51fab0a
3 changed files with 19 additions and 14 deletions
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
|
@ -52,8 +52,7 @@ jobs:
|
|||
- { os: ubuntu-latest, configType: Release, runTest262: true, runV8: true }
|
||||
- { os: ubuntu-latest, configType: examples }
|
||||
- { os: ubuntu-latest, configType: shared }
|
||||
- { os: ubuntu-latest, configType: asan, runTest262: true }
|
||||
- { os: ubuntu-latest, configType: ubsan, runTest262: true }
|
||||
- { os: ubuntu-latest, configType: asan+ubsan, runTest262: true }
|
||||
- { os: ubuntu-latest, configType: msan }
|
||||
- { os: ubuntu-latest, configType: tcc }
|
||||
- { os: ubuntu-latest, arch: x86 }
|
||||
|
@ -64,15 +63,13 @@ jobs:
|
|||
- { os: macos-14, configType: Release }
|
||||
- { os: macos-14, configType: examples }
|
||||
- { os: macos-14, configType: shared }
|
||||
- { os: macos-14, configType: asan }
|
||||
- { os: macos-14, configType: ubsan }
|
||||
- { os: macos-14, configType: asan+ubsan }
|
||||
|
||||
- { os: macos-12, configType: Debug }
|
||||
- { os: macos-12, configType: Release }
|
||||
- { os: macos-12, configType: examples }
|
||||
- { os: macos-12, configType: shared }
|
||||
- { os: macos-12, configType: asan }
|
||||
- { os: macos-12, configType: ubsan }
|
||||
- { os: macos-12, configType: asan+ubsan }
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
@ -80,7 +77,7 @@ jobs:
|
|||
|
||||
# ASLR with big PIE slides does not work well with [AM]San
|
||||
- name: disable ASLR
|
||||
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.configType == 'asan' || matrix.config.configType == 'ubsan' || matrix.config.configType == 'msan')}}
|
||||
if: ${{ matrix.config.os == 'ubuntu-latest' && (matrix.config.configType == 'asan+ubsan' || matrix.config.configType == 'msan')}}
|
||||
run: |
|
||||
sudo sysctl -w kernel.randomize_va_space=0
|
||||
|
||||
|
@ -119,11 +116,9 @@ jobs:
|
|||
echo "BUILD_EXAMPLES=ON" >> $GITHUB_ENV;
|
||||
elif [ "${{ matrix.config.configType }}" = "shared" ]; then
|
||||
echo "BUILD_SHARED_LIBS=ON" >> $GITHUB_ENV;
|
||||
elif [ "${{ matrix.config.configType }}" = "asan" ]; then
|
||||
elif [ "${{ matrix.config.configType }}" = "asan+ubsan" ]; then
|
||||
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV;
|
||||
echo "CONFIG_ASAN=ON" >> $GITHUB_ENV;
|
||||
elif [ "${{ matrix.config.configType }}" = "ubsan" ]; then
|
||||
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV;
|
||||
echo "CONFIG_UBSAN=ON" >> $GITHUB_ENV;
|
||||
elif [ "${{ matrix.config.configType }}" = "msan" ]; then
|
||||
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV;
|
||||
|
|
|
@ -108,6 +108,10 @@ if(BUILD_SHARED_LIBS)
|
|||
message(STATUS "Building a shared library")
|
||||
endif()
|
||||
|
||||
# note: CONFIG_TSAN is currently incompatible with the other sanitizers but we
|
||||
# don't explicitly check for that because who knows what the future will bring?
|
||||
# CONFIG_MSAN only works with clang at the time of writing; also not checked
|
||||
# for the same reason
|
||||
xoption(BUILD_EXAMPLES "Build examples" OFF)
|
||||
xoption(BUILD_STATIC_QJS_EXE "Build a static qjs executable" OFF)
|
||||
xoption(BUILD_CLI_WITH_MIMALLOC "Build the qjs executable with mimalloc" OFF)
|
||||
|
@ -132,7 +136,9 @@ add_link_options(
|
|||
-fno-sanitize-recover=all
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
elseif(CONFIG_MSAN)
|
||||
endif()
|
||||
|
||||
if(CONFIG_MSAN)
|
||||
message(STATUS "Building with MSan")
|
||||
add_compile_options(
|
||||
-fsanitize=memory
|
||||
|
@ -144,7 +150,9 @@ add_link_options(
|
|||
-fno-sanitize-recover=all
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
elseif(CONFIG_TSAN)
|
||||
endif()
|
||||
|
||||
if(CONFIG_TSAN)
|
||||
message(STATUS "Building with TSan")
|
||||
add_compile_options(
|
||||
-fsanitize=thread
|
||||
|
@ -156,7 +164,9 @@ add_link_options(
|
|||
-fno-sanitize-recover=all
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
elseif(CONFIG_UBSAN)
|
||||
endif()
|
||||
|
||||
if(CONFIG_UBSAN)
|
||||
message(STATUS "Building with UBSan")
|
||||
add_compile_definitions(
|
||||
__UBSAN__=1
|
||||
|
|
2
Makefile
2
Makefile
|
@ -45,7 +45,7 @@ endif
|
|||
all: $(QJS)
|
||||
|
||||
fuzz:
|
||||
clang -g -O1 -fsanitize=fuzzer -o fuzz fuzz.c
|
||||
clang -g -O1 -fsanitize=address,undefined,fuzzer -o fuzz fuzz.c
|
||||
./fuzz
|
||||
|
||||
$(BUILD_DIR):
|
||||
|
|
Loading…
Reference in a new issue