diff --git a/.github/workflows/ci-asan.yml b/.github/workflows/ci-asan.yml new file mode 100644 index 0000000000..d1958d21ea --- /dev/null +++ b/.github/workflows/ci-asan.yml @@ -0,0 +1,90 @@ +name: Test with ASan + +on: [push, pull_request] + +jobs: + + racketcs-asan: + runs-on: ubuntu-18.04 + container: racket/racket-ci:latest + + env: + ASAN_OPTIONS: 'halt_on_error=0,log_path=racket-asan' + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 100 + - name: Create logs directory + run: mkdir $PWD/logs + - name: Build + run: | + export cpus=$(grep -c ^processor /proc/cpuinfo) + make CPUS="${cpus}" PKGS="racket-test db-test unstable-flonum-lib net-test" CONFIGURE_ARGS_qq='--enable-asan' cs-in-place 2>&1 | tee logs/build.log + - name: Add new racket to PATH + # This should be: + # run: echo "::add-path::${{ github.workspace }}/racket/bin" + # but due to a github bug, the variable ${{ github.workspace }} value inside a container is broken + # so we hard code the real value + run: | + echo "::add-path::/__w/racket/racket/racket/bin" + find /__w/racket/racket/racket/bin -type f + - name: Racket version + run: | + which racket + racket --version + - name: Run tests/racket/test + continue-on-error: true + run: raco test -l tests/racket/test + - name: Run tests/racket/contract/all + continue-on-error: true + run: racket -l tests/racket/contract/all + - name: Run tests/json/json + continue-on-error: true + run: raco test -l tests/json/json + - name: Run tests/file/main + continue-on-error: true + run: raco test -l tests/file/main + - name: Run tests/net/head + continue-on-error: true + run: raco test -l tests/net/head + - name: Run tests/net/uri-codec + continue-on-error: true + run: raco test -l tests/net/uri-codec + - name: Run tests/net/url + continue-on-error: true + run: raco test -l tests/net/url + - name: Run tests/net/url-port + continue-on-error: true + run: raco test -l tests/net/url-port + - name: Run tests/net/encoders + continue-on-error: true + run: raco test -l tests/net/encoders + - name: Run tests/openssl/basic + continue-on-error: true + run: raco test -l tests/openssl/basic + - name: Run tests/openssl/https + continue-on-error: true + run: raco test -l tests/openssl/https + - name: Run tests/match/main + continue-on-error: true + run: raco test -l tests/match/main + - name: Run tests/zo-path + continue-on-error: true + run: raco test -l tests/zo-path + - name: Run tests/xml + continue-on-error: true + run: raco test -c tests/xml + - name: Run tests/future + continue-on-error: true + run: raco test -c tests/future + - name: Run tests/stxparse + continue-on-error: true + run: raco test -c tests/stxparse + - name: Run db tests + continue-on-error: true + run: raco test -l tests/db/all-tests + - uses: actions/upload-artifact@v2 + with: + name: asan-errors-cs_git${{ github.sha }} + path: ./racket-asan.* diff --git a/.github/workflows/ci-ubsan.yml b/.github/workflows/ci-ubsan.yml index 84cc8040a3..d7244e38c5 100644 --- a/.github/workflows/ci-ubsan.yml +++ b/.github/workflows/ci-ubsan.yml @@ -1,11 +1,11 @@ -name: Test with Sanitizers +name: Test with UBSan on: [push, pull_request] jobs: # Build jobs -# These jobs build Racket using the sanitizers and gather the results into a final log +# These jobs build Racket using undefined behaviour sanitizers and gathers the results into a final log racket3m-ubsan: runs-on: ubuntu-18.04 container: racket/racket-ci:latest @@ -178,3 +178,4 @@ jobs: with: name: runtime-errors-cs_git${{ github.sha }} path: runtime-errors_git${{ github.sha }}.log + diff --git a/racket/src/ac/asan.m4 b/racket/src/ac/asan.m4 new file mode 100644 index 0000000000..d279e6ade6 --- /dev/null +++ b/racket/src/ac/asan.m4 @@ -0,0 +1,8 @@ +if test "${enable_asan}" = "yes" ; then + ASAN="-fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -fno-common" + CFLAGS="$CFLAGS $ASAN" + CPPFLAGS="$CPPFLAGS $ASAN" + PREFLAGS="$PREFLAGS $ASAN" + LDFLAGS="$LDFLAGS $ASAN" +fi + diff --git a/racket/src/ac/asan_arg.m4 b/racket/src/ac/asan_arg.m4 new file mode 100644 index 0000000000..556b4d2795 --- /dev/null +++ b/racket/src/ac/asan_arg.m4 @@ -0,0 +1 @@ +AC_ARG_ENABLE(asan, [ --enable-asan compile with -fsanitize=address]) diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure index 38a6f8ed16..dce3e74a6c 100755 --- a/racket/src/cs/c/configure +++ b/racket/src/cs/c/configure @@ -796,6 +796,7 @@ enable_mac64 enable_libs enable_noopt enable_ubsan +enable_asan enable_bcdefault enable_csonly enable_csdefault @@ -1446,6 +1447,7 @@ Optional Features: --enable-libs install static libraries (enabled by default for Unix) --enable-strip strip debug on install (usually enabled by default) --enable-ubsan compile with -fsanitize=undefined + --enable-asan compile with -fsanitize=address --enable-bcdefault install BC without suffix --enable-bconly BC default, and skip CS build --enable-csdefault install CS without suffix @@ -2679,6 +2681,12 @@ if test "${enable_ubsan+set}" = set; then : fi +# Check whether --enable-asan was given. +if test "${enable_asan+set}" = set; then : + enableval=$enable_asan; +fi + + # Check whether --enable-bcdefault was given. if test "${enable_bcdefault+set}" = set; then : enableval=$enable_bcdefault; @@ -4727,6 +4735,18 @@ if test "${enable_ubsan}" = "yes" ; then fi +############## ubsan ################ + +if test "${enable_asan}" = "yes" ; then + ASAN="-fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -fno-common" + CFLAGS="$CFLAGS $ASAN" + CPPFLAGS="$CPPFLAGS $ASAN" + PREFLAGS="$PREFLAGS $ASAN" + LDFLAGS="$LDFLAGS $ASAN" +fi + + + ############## Makefile includes ################ if test "$INCLUDEDEP" = "#" ; then diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac index 493bda774b..ceea532ac1 100644 --- a/racket/src/cs/c/configure.ac +++ b/racket/src/cs/c/configure.ac @@ -28,6 +28,7 @@ m4_include(../ac/sdk_arg.m4) m4_include(../ac/instlib_arg.m4) m4_include(../ac/strip_arg.m4) m4_include(../ac/ubsan_arg.m4) +m4_include(../ac/asan_arg.m4) m4_include(../ac/vm_arg.m4) m4_include(../ac/crossany_arg.m4) AC_ARG_ENABLE(libz, [ --enable-libz use installed libz if available]) @@ -470,6 +471,10 @@ fi m4_include(../ac/ubsan.m4) +############## ubsan ################ + +m4_include(../ac/asan.m4) + ############## Makefile includes ################ if test "$INCLUDEDEP" = "#" ; then