public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] sigsuspend: Add testcase for EFAULT
@ 2024-07-09  9:50 Ma Xinjian via ltp
  2024-09-17  9:44 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Ma Xinjian via ltp @ 2024-07-09  9:50 UTC (permalink / raw)
  To: ltp

Add a testcase with the mask parameter points to an invalid address.

Signed-off-by: Ma Xinjian <maxj.fnst@fujitsu.com>
---
 runtest/syscalls                              |  1 +
 .../kernel/syscalls/sigsuspend/.gitignore     |  1 +
 .../kernel/syscalls/sigsuspend/sigsuspend02.c | 34 +++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 testcases/kernel/syscalls/sigsuspend/sigsuspend02.c

diff --git a/runtest/syscalls b/runtest/syscalls
index b6cadb2df..373f4d2e6 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -1496,6 +1496,7 @@ sigprocmask01 sigprocmask01
 sigrelse01 sigrelse01
 
 sigsuspend01 sigsuspend01
+sigsuspend02 sigsuspend02
 
 sigtimedwait01 sigtimedwait01
 
diff --git a/testcases/kernel/syscalls/sigsuspend/.gitignore b/testcases/kernel/syscalls/sigsuspend/.gitignore
index 46ea52f73..926b73571 100644
--- a/testcases/kernel/syscalls/sigsuspend/.gitignore
+++ b/testcases/kernel/syscalls/sigsuspend/.gitignore
@@ -1 +1,2 @@
 /sigsuspend01
+/sigsuspend02
diff --git a/testcases/kernel/syscalls/sigsuspend/sigsuspend02.c b/testcases/kernel/syscalls/sigsuspend/sigsuspend02.c
new file mode 100644
index 000000000..5bfed9d2d
--- /dev/null
+++ b/testcases/kernel/syscalls/sigsuspend/sigsuspend02.c
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
+ * Copyright (c) Linux Test Project, 2024
+ * Author: Ma Xinjian <maxj.fnst@fujitsu.com>
+
+/*\
+ * [Description]
+ *
+ * Verify that sigsuspend(2) fails with
+ *
+ * - EFAULT mask points to memory which is not a valid part of the
+ *          process address space.
+ */
+
+#include "tst_test.h"
+
+static void *invalid_mask;
+
+static void setup(void)
+{
+        invalid_mask = tst_get_bad_addr(NULL);
+}
+
+static void verify_sigsuspend(void)
+{
+        TST_EXP_FAIL(sigsuspend(invalid_mask), EFAULT);
+}
+
+static struct tst_test test = {
+        .test_all = verify_sigsuspend,
+        .setup = setup,
+};
+
-- 
2.18.1

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

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

* Re: [LTP] [PATCH] sigsuspend: Add testcase for EFAULT
  2024-07-09  9:50 [LTP] [PATCH] sigsuspend: Add testcase for EFAULT Ma Xinjian via ltp
@ 2024-09-17  9:44 ` Cyril Hrubis
  2024-09-17  9:49   ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2024-09-17  9:44 UTC (permalink / raw)
  To: Ma Xinjian; +Cc: ltp

> +/*
> + * Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
> + * Copyright (c) Linux Test Project, 2024
> + * Author: Ma Xinjian <maxj.fnst@fujitsu.com>
> +

I've added */ here to end the first comment and pushed, thanks.

> +/*\
> + * [Description]
> + *
> + * Verify that sigsuspend(2) fails with
> + *
> + * - EFAULT mask points to memory which is not a valid part of the
> + *          process address space.
> + */

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH] sigsuspend: Add testcase for EFAULT
  2024-09-17  9:44 ` Cyril Hrubis
@ 2024-09-17  9:49   ` Cyril Hrubis
  0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2024-09-17  9:49 UTC (permalink / raw)
  To: Ma Xinjian; +Cc: ltp

Hi!
And also replaced spaces with tabs.

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

end of thread, other threads:[~2024-09-17  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-09  9:50 [LTP] [PATCH] sigsuspend: Add testcase for EFAULT Ma Xinjian via ltp
2024-09-17  9:44 ` Cyril Hrubis
2024-09-17  9:49   ` Cyril Hrubis

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