syscall02: test invalid syscall number -1
PATCH v3 1/1 syscall02: test invalid syscall number -1
From: Andrea Cervesato <[email protected]>
Add a test verifying that a raw syscall() with the reserved number -1 fails with ENOSYS.
Signed-off-by Andrea Cervesato <[email protected]>
---
Changes in v3:
- enable all arches
- Link to v2: https://lore.kernel.org/[email protected]
Changes in v2:
- update imports and description
- Link to v1: https://lore.kernel.org/[email protected]
--- runtest/syscalls | 1 + testcases/kernel/syscalls/syscall/.gitignore | 1 + testcases/kernel/syscalls/syscall/syscall02.c | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+)
runtest/syscalls +1 -0
@@ -1688,6 +1688,7 @@ sync_file_range01 sync_file_range01 sync_file_range02 sync_file_range02 syscall01 syscall01 +syscall02 syscall02 sysconf01 sysconf01
testcases/kernel/syscalls/syscall/.gitignore +1 -0
@@ -1 +1,2 @@ /syscall01 +/syscall02
testcases/kernel/syscalls/syscall/syscall02.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2026 SUSE LLC Andrea Cervesato <[email protected]> +*/ + +/*\ +* 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,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Reviewed-by Cyril Hrubis <[email protected]>
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedMerged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp