* [LTP] [PATCH v2] syscall02: test invalid syscall number -1
@ 2026-07-14 10:56 Andrea Cervesato
2026-07-14 12:18 ` [LTP] " linuxtestproject.agent
2026-07-14 12:48 ` [LTP] [PATCH v2] " Cyril Hrubis
0 siblings, 2 replies; 3+ messages in thread
From: Andrea Cervesato @ 2026-07-14 10:56 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. The behavior is architecture specific, so the test is
limited to the architectures where it was checked against kernel code.
Signed-off-by: Andrea Cervesato <andrea.cervesato@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 | 31 +++++++++++++++++++++++++++
3 files changed, 33 insertions(+)
diff --git a/runtest/syscalls b/runtest/syscalls
index a021c79da49d4157c33187caed2dd3f0483759e0..8a777e61da1af59ba694e0bc5b5d92bb1d63754a 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -1678,6 +1678,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..2fefcb17c763813653a6644759c2a035bee2c604
--- /dev/null
+++ b/testcases/kernel/syscalls/syscall/syscall02.c
@@ -0,0 +1,31 @@
+// 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.
+ *
+ * The behavior of number -1 is architecture specific, so the test only runs on
+ * the architectures where it has been verified against the kernel entry code.
+ */
+
+#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,
+ .supported_archs = (const char *const []) {
+ "x86_64",
+ "aarch64",
+ NULL
+ },
+};
---
base-commit: 7ca5dc366a558f3666223e6abe579edd90bafd38
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* Re: [LTP] syscall02: test invalid syscall number -1
2026-07-14 10:56 [LTP] [PATCH v2] syscall02: test invalid syscall number -1 Andrea Cervesato
@ 2026-07-14 12:18 ` linuxtestproject.agent
2026-07-14 12:48 ` [LTP] [PATCH v2] " Cyril Hrubis
1 sibling, 0 replies; 3+ messages in thread
From: linuxtestproject.agent @ 2026-07-14 12:18 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi Andrea,
On Tue, 14 Jul 2026 12:56:04 +0200, Andrea Cervesato wrote:
> syscall02: test invalid syscall number -1
> Add a test verifying that a raw syscall() with the reserved number -1
> fails with ENOSYS.
The subject and the doc comment inside the test both say "invalid syscall
number -1", but the commit body says "reserved number -1". These terms
carry different meanings. "Reserved" implies deliberate kernel allocation
for a specific purpose, while "invalid" is the user-facing description
for an out-of-range syscall number. Could "reserved" be changed to
"invalid" here to match the subject and the test description block?
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH v2] syscall02: test invalid syscall number -1
2026-07-14 10:56 [LTP] [PATCH v2] syscall02: test invalid syscall number -1 Andrea Cervesato
2026-07-14 12:18 ` [LTP] " linuxtestproject.agent
@ 2026-07-14 12:48 ` Cyril Hrubis
1 sibling, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2026-07-14 12:48 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
Hi!
> diff --git a/runtest/syscalls b/runtest/syscalls
> index a021c79da49d4157c33187caed2dd3f0483759e0..8a777e61da1af59ba694e0bc5b5d92bb1d63754a 100644
> --- a/runtest/syscalls
> +++ b/runtest/syscalls
> @@ -1678,6 +1678,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..2fefcb17c763813653a6644759c2a035bee2c604
> --- /dev/null
> +++ b/testcases/kernel/syscalls/syscall/syscall02.c
> @@ -0,0 +1,31 @@
> +// 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.
> + *
> + * The behavior of number -1 is architecture specific, so the test only runs on
> + * the architectures where it has been verified against the kernel entry code.
> + */
> +
> +#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,
> + .supported_archs = (const char *const []) {
> + "x86_64",
> + "aarch64",
> + NULL
> + },
> +};
I do not think that there is an architecture that has a valid syscall
mapped to -1. I do not think that we need to restrict the architecture
here.
--
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:[~2026-07-14 12:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 10:56 [LTP] [PATCH v2] syscall02: test invalid syscall number -1 Andrea Cervesato
2026-07-14 12:18 ` [LTP] " linuxtestproject.agent
2026-07-14 12:48 ` [LTP] [PATCH v2] " Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox