]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
kselftest/coredump: reintroduce null pointer dereference
authorEmanuele Rocca <emanuele.rocca@arm.com>
Fri, 20 Mar 2026 19:46:43 +0000 (20:46 +0100)
committerChristian Brauner <brauner@kernel.org>
Mon, 23 Mar 2026 15:27:10 +0000 (16:27 +0100)
Commit 673a55cc49da replaced the null pointer dereference used in
crashing_child() with __builtin_trap to address the following LLVM warnings:

 coredump_test_helpers.c:59:6: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
 coredump_test_helpers.c:59:6: note: consider using __builtin_trap() or qualifying pointer with 'volatile'

All coredump tests expect crashing_child() to result in a SIGSEGV. However, the
behavior of __builtin_trap is architecture-dependent. On x86 it yields SIGILL,
on aarch64 SIGTRAP. Given that neither of those signals are SIGSEGV, both
coredump_socket_test and coredump_socket_protocol_test are currently failing:

 get_pidfd_info: mask=0xd7, coredump_mask=0x5, coredump_signal=5
 socket_coredump_signal_sigsegv: coredump_signal=5, expected SIGSEGV=11

Qualify the pointer with volatile instead of calling __builtin_trap to fix the
tests.

Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
Link: https://patch.msgid.link/ab2kI0PI_Vk6bU88@NH27D9T0LF
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
tools/testing/selftests/coredump/coredump_test_helpers.c

index 5c8adee63641490f7b949d291728b18d2befb220..2c850e0b1b57c3561664dfebf8a064b58f8fe6da 100644 (file)
@@ -56,7 +56,7 @@ void crashing_child(void)
                pthread_create(&thread, NULL, do_nothing, NULL);
 
        /* crash on purpose */
-       __builtin_trap();
+       i = *(volatile int *)NULL;
 }
 
 int create_detached_tmpfs(void)