linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/coredump: Fix "socket_detect_userspace_client" test failure
@ 2025-06-20 11:02 Nam Cao
  2025-06-23 10:39 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: Nam Cao @ 2025-06-20 11:02 UTC (permalink / raw)
  To: Christian Brauner, Alexander Viro, Jan Kara, Shuah Khan,
	Luca Boccassi, Alexander Mikhalitsyn, linux-kselftest,
	linux-fsdevel, linux-kernel
  Cc: Nam Cao

The coredump.socket_detect_userspace_client test occasionally fails:
    #  RUN           coredump.socket_detect_userspace_client ...
    # stackdump_test.c:500:socket_detect_userspace_client:Expected 0 (0) != WIFEXITED(status) (0)
    # socket_detect_userspace_client: Test terminated by assertion
    #          FAIL  coredump.socket_detect_userspace_client
    not ok 3 coredump.socket_detect_userspace_client

because there is no guarantee that client's write() happens before server's
close(). The client gets terminated SIGPIPE, and thus the test fails.

Add a read() to server to make sure server's close() doesn't happen before
client's write().

Fixes: 7b6724fe9a6b ("selftests/coredump: add tests for AF_UNIX coredumps")
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 tools/testing/selftests/coredump/stackdump_test.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/coredump/stackdump_test.c b/tools/testing/selftests/coredump/stackdump_test.c
index 9984413be9f06..68f8e479ac368 100644
--- a/tools/testing/selftests/coredump/stackdump_test.c
+++ b/tools/testing/selftests/coredump/stackdump_test.c
@@ -461,10 +461,15 @@ TEST_F(coredump, socket_detect_userspace_client)
 			_exit(EXIT_FAILURE);
 		}
 
+		ret = read(fd_coredump, &c, 1);
+
 		close(fd_coredump);
 		close(fd_server);
 		close(fd_peer_pidfd);
 		close(fd_core_file);
+
+		if (ret < 1)
+			_exit(EXIT_FAILURE);
 		_exit(EXIT_SUCCESS);
 	}
 	self->pid_coredump_server = pid_coredump_server;
-- 
2.39.5


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

* Re: [PATCH] selftests/coredump: Fix "socket_detect_userspace_client" test failure
  2025-06-20 11:02 [PATCH] selftests/coredump: Fix "socket_detect_userspace_client" test failure Nam Cao
@ 2025-06-23 10:39 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2025-06-23 10:39 UTC (permalink / raw)
  To: Nam Cao
  Cc: Christian Brauner, Alexander Viro, Jan Kara, Shuah Khan,
	Luca Boccassi, Alexander Mikhalitsyn, linux-kselftest,
	linux-fsdevel, linux-kernel

On Fri, 20 Jun 2025 13:02:52 +0200, Nam Cao wrote:
> The coredump.socket_detect_userspace_client test occasionally fails:
>     #  RUN           coredump.socket_detect_userspace_client ...
>     # stackdump_test.c:500:socket_detect_userspace_client:Expected 0 (0) != WIFEXITED(status) (0)
>     # socket_detect_userspace_client: Test terminated by assertion
>     #          FAIL  coredump.socket_detect_userspace_client
>     not ok 3 coredump.socket_detect_userspace_client
> 
> [...]

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] selftests/coredump: Fix "socket_detect_userspace_client" test failure
      https://git.kernel.org/vfs/vfs/c/ce9bb9487ef0

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

end of thread, other threads:[~2025-06-23 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 11:02 [PATCH] selftests/coredump: Fix "socket_detect_userspace_client" test failure Nam Cao
2025-06-23 10:39 ` Christian Brauner

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).