Skip to content

Commit f8dfaed

Browse files
committed
Added TSAN support.
Signed-off-by: Toni Uhlig <[email protected]>
1 parent 5f1caeb commit f8dfaed

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.github/workflows/build.yml

+7
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ jobs:
177177
pcre: "--with-pcre"
178178
maxminddb: "--with-maxminddb"
179179
msan: "--with-sanitizer"
180+
- compiler: "default-cc thread sanitizer"
181+
os: ubuntu-latest
182+
arch: "x86_64"
183+
gcrypt: ""
184+
pcre: "--with-pcre"
185+
maxminddb: "--with-maxminddb"
186+
msan: "--with-thread-sanitizer"
180187
- compiler: "default-cc"
181188
os: ubuntu-18.04
182189
arch: "x86_64"

configure.ac

+17-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ AS_IF([test "${with_only_libndpi+set}" = set],[
1414
])
1515

1616
AC_ARG_WITH(sanitizer, AS_HELP_STRING([--with-sanitizer], [Build with support for address, undefined and leak sanitizer]))
17+
AC_ARG_WITH(thread-sanitizer, AS_HELP_STRING([--with-thread-sanitizer], [Build with support for thread sanitizer]))
1718
AC_ARG_ENABLE(fuzztargets, AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
1819
AC_ARG_ENABLE(gprof, AS_HELP_STRING([--enable-gprof], [Enable CPU/HEAP profiling with gperftools]),[enable_gprof=$enableval],[enable_gprof=no])
1920
AC_ARG_ENABLE(code-coverage, AS_HELP_STRING([--enable-code-coverage], [Generate Code Coverage report]))
@@ -24,10 +25,24 @@ AC_ARG_ENABLE(npcap, AS_HELP_STRING([--disable-npcap], [msys2 only: Disable link
2425
AS_IF([test "x$enable_fuzztargets" = "xyes"], [BUILD_FUZZTARGETS=1], [BUILD_FUZZTARGETS=0])
2526
AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
2627

28+
AS_IF([test "${with_sanitizer+set}" = set -a "${with_thread_sanitizer+set}" = set],[
29+
AC_MSG_ERROR([Configure options `--with-sanitizer' and `--with_thread_sanitizer' can not used at the same time.])
30+
])
31+
AS_IF([test "${with_sanitizer+set}" = set -o "${with_thread_sanitizer+set}" = set],[
32+
CFLAGS="${CFLAGS} -O0 -g3"
33+
],[
34+
CFLAGS="${CFLAGS} -g"
35+
])
36+
2737
AS_IF([test "${with_sanitizer+set}" = set],[
28-
CFLAGS="${CFLAGS} -g3 -O0 -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak -fno-omit-frame-pointer"
38+
CFLAGS="${CFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak -fno-omit-frame-pointer"
2939
LDFLAGS="${LDFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak"
30-
],[CFLAGS="${CFLAGS} -g"])
40+
])
41+
42+
AS_IF([test "${with_thread_sanitizer+set}" = set],[
43+
CFLAGS="${CFLAGS} -fsanitize=thread -fno-omit-frame-pointer"
44+
LDFLAGS="${LDFLAGS} -fsanitize=thread"
45+
])
3146

3247
AS_IF([test "x${enable_code_coverage}" = "xyes"],[
3348
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"

0 commit comments

Comments
 (0)