bug#79444: baseenc SIGSEGV on macOS
Pádraig Brady <[email protected]>
| Newsgroups | gmane.comp.gnu.core-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 15/09/2025 15:47, Pádraig Brady wrote: > On 14/09/2025 15:43, Bruno Haible via GNU coreutils Bug Reports wrote: >> Pádraig Brady wrote: >>> p.s. an ASAN build would be good for CI >> >> The CI already includes an ASAN + UBSAN build: see >> https://github.com/coreutils/ci-check/blob/master/.github/workflows/many-platforms.yml#L850 >> named "make check with sanitizers" in >> https://github.com/coreutils/ci-check/actions/runs/17705498910 >> >> If you think that it should have failed in this situation, >> please commit or suggest an improvement. > > Oh right MSAN is required for UMR detection: > > $ ./configure CC=clang > $ make -j8 AM_CFLAGS='-Ulint -fsanitize=memory' > > $ src/basenc --base32 -d /dev/null WARNING: MemorySanitizer: use-of-uninitialized-value > #0 in decode_ctx_finalize /home/padraig/git/coreutils/src/basenc.c:358:14 > #1 in do_decode /home/padraig/git/coreutils/src/basenc.c:1559:18 > #2 in main /home/padraig/git/coreutils/src/basenc.c:1770:5 > > MSAN works in this case, but it doesn't look usable in general > as it requires all used libs to be built with MSAN enabled > or tracking is lost, resulting in false positives. > I.e. any calls to gettext, regex, gmp, ... will induce false positives. > > So for UMR checking with the coreutils test suite, > coreutils/README-valgrind seems like the best solution currently. Note one can perturb the stack with gcc and clang at least with the -ftrivial-auto-var-init=pattern option. I've confirmed that it triggers a segfault on my Linux system with this code issue. It's lightweight, so I've added it in my default dev environment, but it might be worth enabling on CI systems too? My defaut dev environment has these now: export CFLAGS='-O2 -g -ftrivial-auto-var-init=pattern' export MALLOC_CHECK_=3 # The following can cause performance issues # so ensure unset before performance testing for example # export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) cheers, Padraig