[LTP] [PATCH v2] waitid10: raise SIGFPE directly

Cyril Hrubis chrubis@suse.cz
Thu May 12 15:10:02 CEST 2022


The SIGFPE for division by zero is actually not send for quite a few
architectures (ARM for instance) and even on x86 and x86_64 we need to
work around compiler to make it generate code that actually triggers the
condition.

So this patch fixes the test in the simplest way possible. the child
just directly raises SIGFPE instead.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/waitid/waitid10.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/syscalls/waitid/waitid10.c b/testcases/kernel/syscalls/waitid/waitid10.c
index e75edd07e..388b31cc9 100644
--- a/testcases/kernel/syscalls/waitid/waitid10.c
+++ b/testcases/kernel/syscalls/waitid/waitid10.c
@@ -24,12 +24,8 @@ static void run(void)
 	pid_t pidchild;
 
 	pidchild = SAFE_FORK();
-	if (!pidchild) {
-		volatile int a, zero = 0;
-
-		a = 1 / zero;
-		exit(a);
-	}
+	if (!pidchild)
+		raise(SIGFPE);
 
 	TST_EXP_PASS(waitid(P_ALL, 0, infop, WEXITED));
 	TST_EXP_EQ_LI(infop->si_pid, pidchild);
-- 
2.35.1



More information about the ltp mailing list