Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/waitid10: Fix on ARM, PPC and possibly others
@ 2022-03-10 10:55 Cyril Hrubis
  2022-03-10 10:58 ` Cyril Hrubis
  2022-04-19  8:07 ` Jan Stancek
  0 siblings, 2 replies; 9+ messages in thread
From: Cyril Hrubis @ 2022-03-10 10:55 UTC (permalink / raw)
  To: ltp

While integer division by zero does trap on x86_64 and causes the SIGFPE
signal to be delivered it's not the case on all architecutes. At least
on ARM and PPC64LE division by zero simply returns undefined result
instead.

This patch adds raise(SIGFPE) at the end of the child as a fallback to
make sure the process is killed with the right signal on all
architectures.

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

diff --git a/testcases/kernel/syscalls/waitid/waitid10.c b/testcases/kernel/syscalls/waitid/waitid10.c
index 869ef18bd..8c351d120 100644
--- a/testcases/kernel/syscalls/waitid/waitid10.c
+++ b/testcases/kernel/syscalls/waitid/waitid10.c
@@ -28,7 +28,10 @@ static void run(void)
 		volatile int a, zero = 0;
 
 		a = 1 / zero;
-		exit(a);
+
+		tst_res(TINFO, "Division by zero didn't trap, raising SIGFPE");
+
+		raise(SIGFPE);
 	}
 
 	TST_EXP_PASS(waitid(P_ALL, 0, infop, WEXITED));
-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-04-19  8:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-10 10:55 [LTP] [PATCH] syscalls/waitid10: Fix on ARM, PPC and possibly others Cyril Hrubis
2022-03-10 10:58 ` Cyril Hrubis
2022-03-21 15:48   ` Richard Palethorpe
2022-03-22  9:24     ` Cyril Hrubis
2022-03-30 13:29       ` Richard Palethorpe
2022-03-30 13:37     ` Martin Doucha
2022-03-31 10:07       ` Richard Palethorpe
2022-03-31 13:08         ` Cyril Hrubis
2022-04-19  8:07 ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox