From fed92e28c5ae51e3f1356caec42fef35552c0867 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 25 Apr 2025 09:45:11 -0300 Subject: [PATCH] nptl: xfail tst-cleanup2 when building with ubsan 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile index 5acf505a90..1888f9d297 100644 --- a/sysdeps/pthread/Makefile +++ b/sysdeps/pthread/Makefile @@ -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 \ -- 2.47.2