Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v3] syscall02: test invalid syscall number -1
@ 2026-07-14 12:51 Andrea Cervesato
  2026-07-14 12:58 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Andrea Cervesato @ 2026-07-14 12:51 UTC (permalink / raw)
  To: Linux Test Project

From: Andrea Cervesato <andrea.cervesato@suse.com>

Add a test verifying that a raw syscall() with the reserved number -1
fails with ENOSYS.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Changes in v3:
- enable all arches
- Link to v2: https://lore.kernel.org/20260714-syscall_invalid_nr-v2-1-b94a8f60f112@suse.com

Changes in v2:
- update imports and description
- Link to v1: https://lore.kernel.org/20260714-syscall_invalid_nr-v1-1-d8b6f4e3ec7b@suse.com
---
 runtest/syscalls                              |  1 +
 testcases/kernel/syscalls/syscall/.gitignore  |  1 +
 testcases/kernel/syscalls/syscall/syscall02.c | 23 +++++++++++++++++++++++
 3 files changed, 25 insertions(+)

diff --git a/runtest/syscalls b/runtest/syscalls
index 789d1550d890e547b1014c39b103ec32f00e7c5b..2be7012a6cd4728b799421a865aae9b0cf5cf72c 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -1688,6 +1688,7 @@ sync_file_range01 sync_file_range01
 sync_file_range02 sync_file_range02
 
 syscall01 syscall01
+syscall02 syscall02
 
 sysconf01 sysconf01
 
diff --git a/testcases/kernel/syscalls/syscall/.gitignore b/testcases/kernel/syscalls/syscall/.gitignore
index 74a081e40cb564e874e0f81478d3d1a0e95b6df4..fed1d81079450a7442023447285cd112924f7a10 100644
--- a/testcases/kernel/syscalls/syscall/.gitignore
+++ b/testcases/kernel/syscalls/syscall/.gitignore
@@ -1 +1,2 @@
 /syscall01
+/syscall02
diff --git a/testcases/kernel/syscalls/syscall/syscall02.c b/testcases/kernel/syscalls/syscall/syscall02.c
new file mode 100644
index 0000000000000000000000000000000000000000..be79ffbc0663468ec1eb95d26cc10a80b34216f5
--- /dev/null
+++ b/testcases/kernel/syscalls/syscall/syscall02.c
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2026 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * Verify that a raw :manpage:`syscall(2)` with the invalid system call
+ * number -1 fails with ENOSYS.
+ */
+
+#define _GNU_SOURCE
+#include <unistd.h>
+
+#include "tst_test.h"
+
+static void run(void)
+{
+	TST_EXP_FAIL2(syscall(-1), ENOSYS, "invalid syscall number -1");
+}
+
+static struct tst_test test = {
+	.test_all = run,
+};

---
base-commit: 23177659f273cd792298067a676c3590493cc76d
change-id: 20260714-syscall_invalid_nr-cf61f64f2741

Best regards,
-- 
Andrea Cervesato <andrea.cervesato@suse.com>


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

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

end of thread, other threads:[~2026-07-14 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 12:51 [LTP] [PATCH v3] syscall02: test invalid syscall number -1 Andrea Cervesato
2026-07-14 12:58 ` Cyril Hrubis
2026-07-14 13:05   ` Andrea Cervesato via ltp

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