[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250517122740.35043-1-sameekshasankpal@gmail.com>
Date: Sat, 17 May 2025 17:57:40 +0530
From: Sameeksha Sankpal <sameekshasankpal@...il.com>
To: skhan@...uxfoundation.org,
kees@...nel.org,
luto@...capital.net,
wad@...omium.org,
shuah@...nel.org
Cc: linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
Sameeksha Sankpal <sameekshasankpal@...il.com>
Subject: [PATCH] selftests/seccomp: report errno and add hints on failure
Signed-off-by: Sameeksha Sankpal <sameekshasankpal@...il.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
Powered by blists - more mailing lists