From nobody Tue Jul 7 20:57:47 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 4gvtpn3pCgz6kT6w for ; Tue, 07 Jul 2026 20:57:53 +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 4gvtpn1tPLz3lyR for ; Tue, 07 Jul 2026 20:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783457873; 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=1YBtaFHC6gAihc9misiTB23cteNiWJMJ7E1l25blyOk=; b=uf75RoT0dGgind0GmwAEG0FEf1MR60J0a3Pc7n7HXMwojUEp5XWDNJPMvk47v4SDDaltTR zCB+33ljXXp5KY6EO0W4AhnqtVy+gxLLj6pUV+SbWow8x1SBtwZEcfeSFneDuu2GoL2wHA rcrBBL+hvavRAoKxsWDJp7w2obekK2BkYqZRgATFNQRAIEV6hWM4QQ/8AaBYyOm/7/UA8h zRIKm8w40d2ygG9nLsCK5Wl3wrRba7Khz9kov+ZL73+3iHnFghdJhx23PPRFKKU2RnyJ6w Dk9GPI8s7SlwSf80iDMfV8aLuHY8K9HS3jOKSs0169BBfBA/+l4eRRzwJryY2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783457873; a=rsa-sha256; cv=none; b=N78XC6whzGsIKsMIJljJ7j+EDSU6SleRWGuZPfC1pG9cp23ONvasqkRspvXACQcdTBN5ws 1FSEE7cW4ube7eC8+CHQty+fSS1lUWis41FxawLcHL6YgLrBV/SLAbs5fp2pr3qhwUGcO6 OVFELS2rUrsncQz4qUBkcNin8PZYFo6KbUey4GmYh+n+QEMSeDWCIK3V/y+sZFkEkauf91 izV9VpfqZ5s0D84Gjb4IiV+geaqCRcdXRUl3NKi12fT6CQ0h4PKx3/lA539YHWdt5puw0H xk+pg+wYAOGJb7USD7Dl6v1lF45bHbouN/rx+JbD9k+wOY40Gdzv0MdC4xjaxQ== 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=1783457873; 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=1YBtaFHC6gAihc9misiTB23cteNiWJMJ7E1l25blyOk=; b=PikE0GRATGGhxqPvpWupBMVEusD9krbKL3p7Ic/LxM5mZ90HN7/7k2RkWKSJLYyXjX8FLC q68P+25uh/ye696cVofHz27NmHY+mLZuvp+oITK0sBmJYoXoZugz0trZo1scEEcltJX5td JPGihldm6B0ANgea4FIYZb0jqfdqzFEWoZrUKO/slb1mMiiM/K8EKguzKqrZ6lXL8xdDH8 leBvXl9cjfCaWjheIqyrC9Cx/m2BZC5xgs7uvXT96XFkdsT91WeEKekJMoV/UEqTgtE46w Zl26k4lIZZq7tAc44F1R3lIEUp3qOgWt0pAO65Ze+qzM5LetwEwPUOe90SMX5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvtpn0k0Dzr8S for ; Tue, 07 Jul 2026 20:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 472f4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 20:57:47 +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: 8adf49dac1a9 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 8adf49dac1a937c9a8dc6937d6d23af14df7597a Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 20:57:47 +0000 Message-Id: <6a4d684b.472f4.78c6cda6@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=8adf49dac1a937c9a8dc6937d6d23af14df7597a commit 8adf49dac1a937c9a8dc6937d6d23af14df7597a Author: Dag-Erling Smørgrav AuthorDate: 2026-06-22 13:23:31 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-07-07 07:06: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 03aca4f19a56..ab68fbf11a6e 100644 --- a/tests/sys/kern/Makefile +++ b/tests/sys/kern/Makefile @@ -94,6 +94,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");