From: Sameeksha Sankpal <sameekshasankpal@gmail.com>
To: skhan@linuxfoundation.org, kees@kernel.org, luto@amacapital.net,
wad@chromium.org, shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Sameeksha Sankpal <sameekshasankpal@gmail.com>
Subject: [PATCH] selftests/seccomp: report errno and add hints on failure
Date: Sat, 17 May 2025 17:57:40 +0530 [thread overview]
Message-ID: <20250517122740.35043-1-sameekshasankpal@gmail.com> (raw)
Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>
---
tools/testing/selftests/seccomp/seccomp_bpf.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 14ba51b52095..d6a85d7b26da 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -4508,7 +4508,11 @@ static char get_proc_stat(struct __test_metadata *_metadata, pid_t pid)
snprintf(proc_path, sizeof(proc_path), "/proc/%d/stat", pid);
ASSERT_EQ(get_nth(_metadata, proc_path, 3, &line), 1);
-
+ int rc = get_nth(_metadata, proc_path, 3, &line);
+ if (rc != 1) {
+ printf("[ERROR] user_notification_fifo: failed to read stat for PID %d (rc=%d)\n", pid, rc);
+ }
+ ASSERT_EQ(rc, 1);
status = *line;
free(line);
@@ -4518,6 +4522,7 @@ static char get_proc_stat(struct __test_metadata *_metadata, pid_t pid)
TEST(user_notification_fifo)
{
struct seccomp_notif_resp resp = {};
+ ksft_print_msg("[INFO] Starting FIFO notification test\n");
struct seccomp_notif req = {};
int i, status, listener;
pid_t pid, pids[3];
@@ -4535,6 +4540,7 @@ TEST(user_notification_fifo)
listener = user_notif_syscall(__NR_getppid,
SECCOMP_FILTER_FLAG_NEW_LISTENER);
ASSERT_GE(listener, 0);
+ ksft_print_msg("[INFO] user_notification_fifo: listener PID is %d\n", listener);
pid = fork();
ASSERT_GE(pid, 0);
--
2.43.0
next reply other threads:[~2025-05-17 12:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-17 12:27 Sameeksha Sankpal [this message]
2025-05-19 15:19 ` Kees Cook
2025-05-28 1:08 ` [PATCH v2] selftests/seccomp: Improve error logging in get_proc_stat() Sameeksha Sankpal
2025-05-28 16:36 ` Kees Cook
2025-05-29 22:55 ` [PATCH v3] selftests/seccomp: Fix indentation and rebase error logging patch Sameeksha Sankpal
[not found] ` <CAGZaOhe0++vMANe1cAXXz=Pt1pf3ZX1vk3U7c0nGRnGGkt8e3A@mail.gmail.com>
[not found] ` <66a49c4b-2008-4059-97aa-59d53fb91c31@linuxfoundation.org>
2025-11-25 4:04 ` Sameeksha Sankpal
2025-11-25 17:25 ` Shuah Khan
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=20250517122740.35043-1-sameekshasankpal@gmail.com \
--to=sameekshasankpal@gmail.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=wad@chromium.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®