public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/ioctl_ns01: fix crash on aarch64
@ 2019-06-11  7:43 Jan Stancek
  2019-06-11  9:43 ` Li Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2019-06-11  7:43 UTC (permalink / raw)
  To: ltp

Test crashes with SIGBUS when using child stack. Align stack to 256 bytes,
which is more than enough for any arch.

Neither parent or library is waiting for child process. Add SIGCHLD to
clone flags.

Check return value of ltp_clone(), and TBROK on failure.

Fix warning about unused *arg.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
index dfde4da6c5d6..625de9bd832d 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ns01.c
@@ -23,7 +23,7 @@
 
 #define STACK_SIZE (1024 * 1024)
 
-static char child_stack[STACK_SIZE];
+static char child_stack[STACK_SIZE] __attribute__((aligned(256)));
 
 static void setup(void)
 {
@@ -53,7 +53,7 @@ static void test_ns_get_parent(void)
 	}
 }
 
-static int child(void *arg)
+static int child(void *arg LTP_ATTRIBUTE_UNUSED)
 {
 	test_ns_get_parent();
 	return 0;
@@ -61,10 +61,14 @@ static int child(void *arg)
 
 static void run(void)
 {
+	int child_pid;
+
 	test_ns_get_parent();
 
-	ltp_clone(CLONE_NEWPID, &child, 0,
+	child_pid = ltp_clone(CLONE_NEWPID | SIGCHLD, &child, 0,
 		STACK_SIZE, child_stack);
+	if (child_pid == -1)
+		tst_brk(TBROK | TERRNO, "ltp_clone failed");
 }
 
 static struct tst_test test = {
-- 
1.8.3.1


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

end of thread, other threads:[~2019-06-11  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-11  7:43 [LTP] [PATCH] syscalls/ioctl_ns01: fix crash on aarch64 Jan Stancek
2019-06-11  9:43 ` Li Wang
2019-06-11  9:58   ` Jan Stancek

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