From: Nikolai Dokutovich <ndokutovich@gmail.com>
To: Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Jeff Layton <jlayton@kernel.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Nikolai Dokutovich <ndokutovich@gmail.com>
Subject: [PATCH 2/2] selftests/namespaces: check that listns() rejects a non-zero spare2
Date: Sat, 28 Nov 2026 17:06:23 +0300 [thread overview]
Message-ID: <20261128140623.19-3-ndokutovich@gmail.com> (raw)
In-Reply-To: <20261128140623.19-1-ndokutovich@gmail.com>
copy_ns_id_req() rejects a non-zero reserved field. Extend the error
case test to cover @spare2 as well as @spare.
Signed-off-by: Nikolai Dokutovich <ndokutovich@gmail.com>
---
tools/testing/selftests/namespaces/listns_test.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/namespaces/listns_test.c b/tools/testing/selftests/namespaces/listns_test.c
index 538d60f908b4..c52b02bd416a 100644
--- a/tools/testing/selftests/namespaces/listns_test.c
+++ b/tools/testing/selftests/namespaces/listns_test.c
@@ -667,6 +667,17 @@ TEST(listns_error_cases)
}
req.spare = 0;
+ /* Test with invalid spare2 field */
+ req.spare2 = 1;
+ ret = sys_listns(&req, ns_ids, ARRAY_SIZE(ns_ids), 0);
+ if (errno == ENOSYS) {
+ /* listns() not supported, skip this check */
+ } else {
+ ASSERT_LT(ret, 0);
+ ASSERT_EQ(errno, EINVAL);
+ }
+ req.spare2 = 0;
+
/* Test with huge nr_ns_ids */
ret = sys_listns(&req, ns_ids, 2000000, 0);
if (errno == ENOSYS) {
--
2.43.0
next prev parent reply other threads:[~2026-11-28 14:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 14:06 [PATCH 0/2] listns(): validate the reserved spare2 field Nikolai Dokutovich
2026-11-28 14:06 ` [PATCH 1/2] nstree: reject a non-zero spare2 in the listns() request Nikolai Dokutovich
2026-11-30 13:04 ` Jan Kara
2026-11-28 14:06 ` Nikolai Dokutovich [this message]
2026-11-28 15:44 ` [PATCH 0/2] listns(): validate the reserved spare2 field Bradley Morgan
2026-11-28 15:49 ` Bradley Morgan
2026-12-01 13:23 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261128140623.19-3-ndokutovich@gmail.com \
--to=ndokutovich@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.