Skip to content

Commit dab8d30

Browse files
authored
Make the CI faster (#2475)
Without the `-fsanitize-memory-track-origins` flag, MSAN job is ~30% faster. Since this flag is useful only while debugging (and not to simply discover memory issues), avoid it on the CI. Note that, by default it is still enabled by default. Right now, MingW runs on *every* ubuntu builds: limit it only to the standard matrix (i.e. ubuntu 20.04, 22.04, 24.04 with default configuration), without any sanitizers (note that MingW doesn't support *san anyway). armhf job is by far the longest job in the CI: remove asan configuration to make it faster. Note that we already have a lot of different jobs (on x86_64) with some sanitizers, and that the other 2 jobs on arm/s390x don't have asan support anyway. If we really, really want a job with arm + asan we can add it as a async/scheduled job. Remove an old workaround for ubuntu jobs Avoid installing packages needed only for the documentation About `check_symbols.sh` script: even if uses the compiled library/objects, it basicaly only checks if we are using, in the source code, same functions that we shoudn't. We don't need to perform the same kind of check so many times..
1 parent 731b75b commit dab8d30

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172
gcrypt: ""
173173
pcre: "--with-pcre2"
174174
maxminddb: "--with-maxminddb"
175-
msan: "--with-memory-sanitizer"
175+
msan: "--with-memory-sanitizer --disable-memory-track-origins"
176176
nBPF: ""
177177
- compiler: "cc"
178178
os: macOS-13
@@ -204,7 +204,7 @@ jobs:
204204
gcrypt: ""
205205
pcre: "--with-pcre2"
206206
maxminddb: "--with-maxminddb"
207-
msan: "--with-sanitizer"
207+
msan: ""
208208
nBPF: ""
209209
- compiler: "cc"
210210
os: ubuntu-latest
@@ -222,20 +222,16 @@ jobs:
222222
- uses: actions/checkout@v4
223223
with:
224224
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
225-
- name: Fix kernel mmap rnd bits on Ubuntu
226-
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64')
227-
run: |
228-
# Workaround for compatinility between latest kernel and sanitizer
229-
# See https://github.com/actions/runner-images/issues/9491
230-
sudo sysctl vm.mmap_rnd_bits=28
231225
- name: Install Ubuntu Prerequisites
232226
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64')
233227
run: |
234228
sudo apt-get update
235229
sudo apt-get install autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev
236-
sudo apt-get install gcc-mingw-w64 libc6-dev
237-
sudo apt-get install doxygen python3-sphinx python3-sphinx-rtd-theme python3-breathe python3-pip
238230
sudo apt-get install rrdtool librrd-dev parallel
231+
- name: Install Ubuntu Prerequisites [Mingw-w64] (runs only on ubuntu jobs)
232+
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && !startsWith(matrix.msan, '--with-') #Only on a few "standard" builds, without any sanitizers
233+
run: |
234+
sudo apt-get install gcc-mingw-w64 libc6-dev
239235
- name: Install Ubuntu Prerequisites (libgcrypt)
240236
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.gcrypt, '--with-local-libgcrypt')
241237
run: |
@@ -333,7 +329,7 @@ jobs:
333329
DESTDIR=/tmp/ndpi make install
334330
ls -alhHR /tmp/ndpi
335331
- name: Test nDPI [SYMBOLS]
336-
if: (startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'mac')) && startsWith(matrix.arch, 'x86_64')
332+
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && !startsWith(matrix.msan, '--with-') #Only on a few "standard" builds, without any sanitizers
337333
run: |
338334
./utils/check_symbols.sh || { FAILED=$?; echo "::error file=${NDPI_LIB}::Unwanted libc symbols found: ${FAILED}. Please make sure to use only ndpi_malloc/ndpi_calloc/ndpi_realloc/ndpi_free wrapper instead of malloc/calloc/realloc/free."; false; }
339335
env:
@@ -369,7 +365,7 @@ jobs:
369365
make dist
370366
./utils/verify_dist_tarball.sh
371367
- name: Build nDPI [Mingw-w64] (runs only on ubuntu jobs)
372-
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && !startsWith(matrix.nBPF, 'nBPF')
368+
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64') && !startsWith(matrix.msan, '--with-') #Only on a few "standard" builds, without any sanitizers
373369
run: |
374370
make distclean
375371
./autogen.sh --enable-option-checking=fatal --enable-debug-messages --enable-tls-sigs --host=x86_64-w64-mingw32

.github/workflows/cifuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
1919
with:
2020
oss-fuzz-project-name: 'ndpi'
21-
fuzz-seconds: 1320
21+
fuzz-seconds: 1200
2222
dry-run: false
2323
sanitizer: ${{ matrix.sanitizer }}
2424
- name: Check Crash (fails when a crash is detected)

configure.ac

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ AC_ARG_WITH(nbpf-path, AS_HELP_STRING([--with-nbpf-path], [nBPF library custom p
3030
AC_ARG_WITH(lto-and-gold-linker, AS_HELP_STRING([--with-lto-and-gold-linker], [Build with LTO and Gold linker]))
3131
AC_ARG_ENABLE(debug-build, AS_HELP_STRING([--enable-debug-build], [Enable debug build (`-g` flag)]),[enable_debugbuild=$enableval],[enable_debugbuild=no])
3232
AC_ARG_ENABLE(global-context-support, AS_HELP_STRING([--disable-global-context-support], [Disable support for global context. No external dependency on libpthread]))
33+
AC_ARG_ENABLE(memory-track-origins, AS_HELP_STRING([--disable-memory-track-origins], [Don't add -fsanitize-memory-track-origins flag when compiling with MASAN support. Useful for faster CI]))
3334

3435
NDPI_CFLAGS="${NDPI_CFLAGS} -D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1"
3536

@@ -81,7 +82,10 @@ AS_IF([test "${with_thread_sanitizer+set}" = set],[
8182
])
8283

8384
AS_IF([test "${with_memory_sanitizer+set}" = set],[
84-
NDPI_CFLAGS="${NDPI_CFLAGS} -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer"
85+
NDPI_CFLAGS="${NDPI_CFLAGS} -fsanitize=memory -fno-omit-frame-pointer"
86+
AS_IF([test "x$enable_memory_track_origins" != "xno"], [
87+
NDPI_CFLAGS="${NDPI_CFLAGS} -fsanitize-memory-track-origins"
88+
])
8589
NDPI_LDFLAGS="${NDPI_LDFLAGS} -fsanitize=memory"
8690
])
8791

0 commit comments

Comments
 (0)