]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nptl: xfail tst-cleanup2 when building with ubsan
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 25 Apr 2025 12:45:11 +0000 (09:45 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 8 May 2025 12:25:49 +0000 (09:25 -0300)
The test explicit uses UB (sprintf (NULL, ...) to triggers a SIGSEGV
from libc and check with the pthread cleanup are correctly called.

With ubsan enable, it triggers:

UBSAN: Undefined behaviour in Xprintf_buffer_write.c:39:7 null pointer passed as argument 1, nonnull attribute declared at unknown:0:0

Which is a memcpy call with NULL argument.

sysdeps/pthread/Makefile

index 5acf505a9034ad6a4d8239b3a8576ffd55e5822a..1888f9d29785b6e19c826c65b092c7e123ea5f5a 100644 (file)
@@ -321,6 +321,10 @@ CFLAGS-tst-cleanupx2.c += -fno-builtin
 CFLAGS-tst-cleanup2.c += $(no-fortify-source)
 CFLAGS-tst-cleanupx2.c += $(no-fortify-source)
 
+# The 'sprintf(NULL, ...' triggers UB within glibc itself.
+test-xfail-tst-cleanup2 = $(enable-ubsan)
+test-xfail-tst-cleanupx2 = $(enable-ubsan)
+
 tests += \
   tst-cancelx2 \
   tst-cancelx3 \