eBPF-based security platform
ci: add a ThreadSanitizer leg to the sanitizer matrix
Daniel Borkmann578cc97ce921
diff --git a/.agents/skills/pre-submit/SKILL.md b/.agents/skills/pre-submit/SKILL.mdindex b8a9570a..54d5ff74 100644--- a/.agents/skills/pre-submit/SKILL.md+++ b/.agents/skills/pre-submit/SKILL.md@@ -61,6 +61,7 @@ make -B CC=clang && make -B CC=clang shirudo-build &&make -B -f Makefile.shirudo CC=clang test-helpersmake tests VM=0 SANITIZE=address,undefined # CC=gcc and CC=clang,# one worktree each+make tests VM=0 SANITIZE=thread CC=clang # and TSan in a thirdsh .github/scripts/msan-deps.sh && # MSan, a worktree ofsh .github/scripts/msan-tests.sh 60 # its ownmake -C testing fuzz FUZZ_SECONDS=60diff --git a/.agents/skills/testing/SKILL.md b/.agents/skills/testing/SKILL.mdindex 74b72852..2c3e8d26 100644--- a/.agents/skills/testing/SKILL.md+++ b/.agents/skills/testing/SKILL.md@@ -20,6 +20,7 @@ make -C testing unit/<suite> # one unit suitemake -C testing functional/<family> # one family, its VM tests toomake tests VM=0 # without the target testsmake tests VM=0 SANITIZE=address,undefined # CI: once with gcc, once with clang+make tests VM=0 SANITIZE=thread CC=clang # CI: TSan, for threads and handlerssh .github/scripts/msan-deps.sh # MSan: instrumented libraries once,sh .github/scripts/msan-tests.sh [60] # then unit and fuzz from a clean treemake -C testing fuzz [FUZZ_SECONDS=60] [FUZZERS=<target>...]diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.ymlindex b00069da..3a28698e 100644--- a/.github/workflows/sanitizers.yml+++ b/.github/workflows/sanitizers.yml@@ -20,23 +20,33 @@ concurrency:cancel-in-progress: truejobs:+ # ThreadSanitizer finds data races and, in a signal handler, a call+ # that is not async-signal-safe or a changed errno. shirudo starts no+ # thread and installs no handler today; the leg is there for the first.tests:- name: ASan+UBSan (${{ matrix.compiler }})+ name: ${{ matrix.name }} (${{ matrix.compiler }})if: github.event_name != 'schedule'runs-on: ubuntu-lateststrategy:fail-fast: falsematrix:- compiler:- - gcc- - clang+ include:+ - name: ASan+UBSan+ sanitize: address,undefined+ compiler: gcc+ - name: ASan+UBSan+ sanitize: address,undefined+ compiler: clang+ - name: TSan+ sanitize: thread+ compiler: clangsteps:- name: Check out repositoryuses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1- # The build does not depend on the compiler under test, so one cache- # entry serves both matrix legs.+ # The build does not depend on the compiler or the sanitizer under+ # test, so one cache entry serves every matrix leg.- name: Restore the sanitizer OpenSSL buildid: sanitizer-openssluses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0@@ -50,7 +60,7 @@ jobs:- name: Build with sanitizers and run the host-side suite in LVH VMuses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33with:- test-name: shirudo-sanitizers-${{ matrix.compiler }}+ test-name: shirudo-sanitizers-${{ matrix.compiler }}-${{ matrix.sanitize == 'thread' && 'tsan' || 'asan' }}image: kindimage-version: bpf-next-20260603.072225kernel-version: bpf-next-main@@ -91,10 +101,10 @@ jobs:export LD_LIBRARY_PATH=/tmp/shirudo-openssl/libexport CC=${{ matrix.compiler }}- make -j4 SANITIZE=address,undefined- make SANITIZE=address,undefined shirudo-build- make -C testing SANITIZE=address,undefined test-helpers- make tests VM=0 SANITIZE=address,undefined+ make -j4 SANITIZE=${{ matrix.sanitize }}+ make SANITIZE=${{ matrix.sanitize }} shirudo-build+ make -C testing SANITIZE=${{ matrix.sanitize }} test-helpers+ make tests VM=0 SANITIZE=${{ matrix.sanitize }}- name: Save the sanitizer OpenSSL buildif: always() && steps.sanitizer-openssl.outputs.cache-hit != 'true' && hashFiles('build/sanitizer-openssl/lib/libcrypto.so') != ''diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rstindex c397f160..8d45fe78 100644--- a/Documentation/contribute/code/developer-guide.rst+++ b/Documentation/contribute/code/developer-guide.rst@@ -203,6 +203,9 @@ variables change it:* - ``SANITIZE=address,undefined``- Instruments the host binaries and the test helpers with ASan andUBSan. See :doc:`/contribute/testing/testing`.+ * - ``SANITIZE=thread``+ - Instruments them with TSan. See+ :doc:`/contribute/testing/testing`.* - ``SANITIZE=memory``- Instruments them with MSan, the vendored libbpf included, andwants the instrumented librariesdiff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rstindex ea76f453..9314b003 100644--- a/Documentation/contribute/testing/testing.rst+++ b/Documentation/contribute/testing/testing.rst@@ -273,6 +273,13 @@ Run under the sanitizersobjects are unaffected. Recovery is off, so every report fails the run.CI runs the same with gcc and with clang.+``SANITIZE=thread`` runs the same tests under ThreadSanitizer, which+reports data races and, in a signal handler, a call that is not+async-signal-safe or a changed ``errno``. shirudo starts no thread and+installs no signal handler, so it reports nothing today; the ``TSan``+leg of the ``Sanitizers`` workflow runs it with clang so that the first+one added is checked.+Run under MemorySanitizer-------------------------