linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/seccomp: report errno and add hints on failure
@ 2025-05-17 12:27 Sameeksha Sankpal
  2025-05-19 15:19 ` Kees Cook
  0 siblings, 1 reply; 5+ messages in thread
From: Sameeksha Sankpal @ 2025-05-17 12:27 UTC (permalink / raw)
  To: skhan, kees, luto, wad, shuah
  Cc: linux-kselftest, linux-kernel, Sameeksha Sankpal

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-29 22:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-17 12:27 [PATCH] selftests/seccomp: report errno and add hints on failure Sameeksha Sankpal
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).