From 8a2b3f75d2b61e5e4ec0a2c93f3db62584daf1cd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 21 May 2023 01:15:40 -0700 Subject: [PATCH] fstat03 wrongly required SIGSEGV Change fstat03 to allow the syscall to signal SIGABRT (or any other signal) instead of SIGSEGV when a null pointer is passed, as POSIX says behavior is undefined and the glibc behavior (which is a bit better defined) could be any signal, not necessarily SIGSEGV. Signed-off-by: Paul Eggert --- testcases/kernel/syscalls/fstat/fstat03.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/fstat/fstat03.c b/testcases/kernel/syscalls/fstat/fstat03.c index 4ff37e882..a400692e9 100644 --- a/testcases/kernel/syscalls/fstat/fstat03.c +++ b/testcases/kernel/syscalls/fstat/fstat03.c @@ -10,7 +10,7 @@ * 1) Calls fstat() with closed file descriptor * -> EBADF * 2) Calls fstat() with an invalid address for stat structure - * -> EFAULT (or receive signal SIGSEGV) + * -> EFAULT (or receive signal) */ #include @@ -70,8 +70,8 @@ static void run(unsigned int tc_num) } SAFE_WAITPID(pid, &status, 0); - if (tcases[tc_num].exp_err == EFAULT && WTERMSIG(status) == SIGSEGV) { - tst_res(TPASS, "fstat() failed as expected with SIGSEGV"); + if (tcases[tc_num].exp_err == EFAULT && WIFSIGNALED(status)) { + tst_res(TPASS, "fstat() failed as expected with a signal"); return; } -- 2.39.2