Skip to content

Commit 91db364

Browse files
committed
fix(scripts): merge libs and Falco TSAN suppressions and disable atomic race reports
Assemble a combined suppressions file from both Falco-specific and libs suppressions at runtime. Add report_atomic_races=0 to TSAN_OPTIONS to suppress Folly hazptr atomic-vs-mutex-init false positives that cannot be matched by suppressions on both stacks. Signed-off-by: irozzo-1A <iacopo@sysdig.com>
1 parent ca7e005 commit 91db364

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

scripts/validate-tsan.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,24 @@ RUN_DURATION_SEC="${RUN_DURATION_SEC:-600}"
3535
RULES_URL="${FALCO_RULES_URL:-https://raw.githubusercontent.com/falcosecurity/rules/main/rules/falco_rules.yaml}"
3636

3737
LIBS_SUPPRESSIONS="${LIBS_SUPPRESSIONS:-/workspaces/libs/userspace/libsinsp/test/tsan_suppressions.txt}"
38-
if [[ -f "$LIBS_SUPPRESSIONS" ]]; then
39-
echo "Using libs suppressions: $LIBS_SUPPRESSIONS (embedded in $SUPPRESSIONS)"
40-
else
41-
echo "Note: libs suppressions path not found ($LIBS_SUPPRESSIONS); using $SUPPRESSIONS only"
42-
fi
38+
FALCO_TSAN_EXTRA="${FALCO_ROOT}/scripts/tsan_suppressions_falco.txt"
4339

4440
if [[ ! -x "$FALCO_BIN" ]]; then
4541
echo "Falco TSAN binary not found. Build with:"
4642
echo " cmake -B build-tsan -DUSE_JEMALLOC=OFF -DCMAKE_CXX_FLAGS=\"-fsanitize=thread\" -DCMAKE_EXE_LINKER_FLAGS=\"-fsanitize=thread\" ... && cmake --build build-tsan --target falco"
4743
exit 1
4844
fi
4945

50-
if [[ ! -f "$SUPPRESSIONS" ]]; then
51-
echo "Suppressions file not found: $SUPPRESSIONS"
46+
mkdir -p "$BUILD_TSAN"
47+
{
48+
[[ -f "$FALCO_TSAN_EXTRA" ]] && cat "$FALCO_TSAN_EXTRA"
49+
[[ -f "$LIBS_SUPPRESSIONS" ]] && cat "$LIBS_SUPPRESSIONS"
50+
} > "$SUPPRESSIONS"
51+
if [[ ! -s "$SUPPRESSIONS" ]]; then
52+
echo "No TSAN suppressions assembled. Add $FALCO_TSAN_EXTRA and/or point LIBS_SUPPRESSIONS at an existing file."
5253
exit 1
5354
fi
55+
echo "TSAN suppressions: $SUPPRESSIONS (Falco: ${FALCO_TSAN_EXTRA}, libs: ${LIBS_SUPPRESSIONS})"
5456

5557
if [[ ! -f "$CONFIG" ]]; then
5658
echo "Config not found: $CONFIG"
@@ -132,8 +134,10 @@ END {
132134
rm -f "${RULES_NO_CONTAINER}.tmp" "${RULES_NO_CONTAINER}.tmp2"
133135
echo "Rules written to $RULES_NO_CONTAINER (container-field macros adapted to never_true, container-dependent rules commented out)"
134136

135-
# TSAN: suppressions + fail-fast on first data race
136-
export TSAN_OPTIONS="suppressions=${SUPPRESSIONS} halt_on_error=1"
137+
# TSAN: suppressions + fail-fast on first data race.
138+
# report_atomic_races=0: Folly hazptr / thread-local StaticMeta can report atomic-vs-mutex-init
139+
# races where one stack is only pthread_mutex_lock; our race: suppressions cannot match both sides.
140+
export TSAN_OPTIONS="suppressions=${SUPPRESSIONS} halt_on_error=1 report_atomic_races=0"
137141
echo "TSAN_OPTIONS=$TSAN_OPTIONS"
138142
echo "Starting Falco under TSAN with 8 workers, Prometheus /metrics, no plugins (log: $TSAN_LOG) ..."
139143

0 commit comments

Comments
 (0)