From nobody Tue Jul 7 20:57:56 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gvtps3wgNz6kT72 for ; Tue, 07 Jul 2026 20:57:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvtpr3C72z3lwR for ; Tue, 07 Jul 2026 20:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783457876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4zS21c8vpB78A7PFahhcnoPEzt7iPUaQPB3Akk1Jlg8=; b=CbVSzVTLIc/rWF1vCQH2Ud0BVaLFWv6zHj7QZTZPVHJhg8G9C5aCHfPkN88edE4mOcxnK+ T96ReVdL+1X9/ZIbHC2HI/e947uuUxioMFo0lzt9FxGqvk9OWnafvUbW9AIH0dUBzSoa+5 5f/cvfVtSHm/AO4eS0U5NSt+sqlnUzilCHCwSQZG+PB8uRAA8Jefo++hIG4dwquglzHv4q 2Q6wUL8b+9qf3HWEuBHUDM22xW1eiN1IZuEuVPxKUIKcn76ad5hUAPJAk5ybF1ImznU+mS 1BSkt1O7Mj/os32SVdTvBi/duuCE2B+ijoEnkDgzv7bOqu1LBtSHkf+cKDL/Qg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783457876; a=rsa-sha256; cv=none; b=wVbS6M3q6m0UimFQBDPHs5BG39Kfcbu0p6wDAxPPfOO7gjKOkK0WMPje7IwHVn785cLDJA p6rEl6QciweF71JUmrwTwqGqbzzSR/Kl54xjE1+YdSMOmPOda7EeNnHKUnPtgyhUjCrXom mPnFIFu99so0t0DcLhFk4cp6jsXHrTzncrCgkUZX6D19XAzLsRXROIoX3sRHjlFzyl9/pZ a1o8cHxB14XEM9hmoPsJGNj9lXUydOuVy69gJEQusnWFHLW/uSjYR6vfDY/x4wnT6NjW8o ZOb9IIySw2/9nPuJjriI1lkRddX8F8PVSgw/CJjaVF3mrb8ykxljBeLsQXmMZg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783457876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4zS21c8vpB78A7PFahhcnoPEzt7iPUaQPB3Akk1Jlg8=; b=S1woA7Toqll+TkrDu/24DXjxvqIL1/F3iob/jag71P6Qxgl5vXhk/eb+TzC0Y7U77tJ1WG j2RARmR/sf3esZ9UV5lvZh1yxLJF3SNdMF4fWax0Bt8N3z3daOf2sGOwQdqH4ROw5dFCU4 eCQlyQuqJokvX8mDSqMnmFgn4e/yIl4DuAip5D6w2B3XKCv+xVA2yqGUyYRlKLPqvPGgGP 6h1bqeLmBj+/MRFd2aAk/0Pq5pPQa8h6anAbp20AVCFBZG3aAZWW+t1jcE4f6Z53QpVVPP I8RJMQW6zbeC6DWIJyg4KAXgXRLxAQRCs9d4K4SFSFupMu02WA/ecckgUQIWoQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvtpr2G3lzrRk for ; Tue, 07 Jul 2026 20:57:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 47a67 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 20:57:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 19a496794685 - stable/14 - tests: Fix race condition in aslr_setuid List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 19a4967946855bb3941382a1a1ccf3c7c1d5a1f3 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 20:57:56 +0000 Message-Id: <6a4d6854.47a67.4a2813bb@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=19a4967946855bb3941382a1a1ccf3c7c1d5a1f3 commit 19a4967946855bb3941382a1a1ccf3c7c1d5a1f3 Author: Dag-Erling Smørgrav AuthorDate: 2026-06-22 13:23:31 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-07 07:07:55 +0000 tests: Fix race condition in aslr_setuid Use a cloexec pipe to block the parent until the child is ready. While here, redirect the output from ping to /dev/null, and mark the test as requiring the inet feature since we ping the IPv4 loopback. PR: 296116 MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57734 (cherry picked from commit 080a4087014e1d19136cc77028019d98b5c69e1e) tests: Fix race condition in aslr_setuid, take 2 Instead of a cloexec pipe, ingest ping's stdout and block until it has printed its initial summary, then close the pipe and return to the main test loop. Run ping in quiet mode so it won't mind that stdout is gone. PR: 296116 MFC after: 1 week Fixes: 080a4087014e ("tests: Fix race condition in aslr_setuid") Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D57763 (cherry picked from commit 86950cf9ffe89b7978fca019019692b3ea492044) --- tests/sys/kern/Makefile | 1 + tests/sys/kern/aslr.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile index d28b6e850636..f9199440903b 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -81,6 +81,7 @@ PROGS+= coredump_phnum_helper PROGS+= pdeathsig_helper PROGS+= sendfile_helper +CFLAGS.aslr+= -I${SRCTOP}/tests LIBADD.aslr+= util LIBADD.copy_file_range+= md LIBADD.jail_lookup_root+= jail util diff --git a/tests/sys/kern/aslr.c b/tests/sys/kern/aslr.c index 13038054603c..966ea5c3b83a 100644 --- a/tests/sys/kern/aslr.c +++ b/tests/sys/kern/aslr.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -19,6 +20,7 @@ #include #include +#include "freebsd_test_suite/macros.h" /* * Spawn an unprivileged child with ASLR force-disabled, which then execs @@ -27,19 +29,22 @@ static pid_t spawn_ping(const atf_tc_t *tc) { + char line[64]; const char *user; struct passwd *passwd; pid_t child; - int arg, error; + int arg, error, io[2]; user = atf_tc_get_config_var(tc, "unprivileged_user"); passwd = getpwnam(user); ATF_REQUIRE(passwd != NULL); + ATF_REQUIRE(pipe2(io, O_CLOEXEC) == 0); child = fork(); ATF_REQUIRE(child >= 0); if (child == 0) { - if (seteuid(passwd->pw_uid) != 0) + if (dup2(io[1], STDOUT_FILENO) != STDOUT_FILENO || + seteuid(passwd->pw_uid) != 0) _exit(1); arg = PROC_ASLR_FORCE_DISABLE; @@ -47,10 +52,12 @@ spawn_ping(const atf_tc_t *tc) if (error != 0) _exit(2); - execl("/sbin/ping", "ping", "127.0.0.1", NULL); + execl("/sbin/ping", "ping", "-q", "127.0.0.1", NULL); _exit(127); } - usleep(500000); /* XXX-MJ */ + ATF_REQUIRE(close(io[1]) == 0); + ATF_REQUIRE(read(io[0], line, sizeof(line)) > 0); + ATF_REQUIRE(close(io[0]) == 0); return (child); } @@ -98,6 +105,7 @@ ATF_TC_BODY(aslr_setuid, tc) pid_t child, pid; int arg, error, st; + ATF_REQUIRE_FEATURE("inet"); if (!atf_tc_has_config_var(tc, "unprivileged_user")) atf_tc_skip("unprivileged_user not set");