Date: Fri, 03 Jul 2026 19:28:58 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 81cf9a0ca765 - main - tests/aslr: Fix spurious test failures Message-ID: <6a480d7a.365d9.7d118348@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81cf9a0ca765b48a430da61c221be17c4d0f753a commit 81cf9a0ca765b48a430da61c221be17c4d0f753a Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-07-03 19:28:22 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-07-03 19:28:30 +0000 tests/aslr: Fix spurious test failures /sbin/ping and /sbin/ping6 are hard-linked, and the vmmap sysctl handler doesn't know which name was used to launch the process. PR: 296116 MFC after: 3 days Fixes: 080a4087014e ("tests: Fix race condition in aslr_setuid") --- tests/sys/kern/aslr.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/sys/kern/aslr.c b/tests/sys/kern/aslr.c index 966ea5c3b83a..e0b696c5130a 100644 --- a/tests/sys/kern/aslr.c +++ b/tests/sys/kern/aslr.c @@ -88,6 +88,18 @@ text_base(pid_t pid, const char *path) return (base); } +static uint64_t +ping_text_base(pid_t pid) +{ + uint64_t base; + + base = text_base(pid, "/sbin/ping"); + if (base == 0) + /* Work around name cache inconsistency. */ + base = text_base(pid, "/sbin/ping6"); + return (base); +} + /* * Make sure that ASLR can't be disabled for a setuid executable by an * unprivileged user. @@ -115,9 +127,9 @@ ATF_TC_BODY(aslr_setuid, tc) "/sbin/ping is not setuid root"); child = spawn_ping(tc); - bases[0] = text_base(child, "/sbin/ping"); + bases[0] = ping_text_base(child); ATF_REQUIRE_MSG(bases[0] != 0, - "failed to find /sbin/ping text segment"); + "failed to find ping text segment"); arg = 0; error = procctl(P_PID, child, PROC_ASLR_STATUS, &arg); @@ -137,9 +149,9 @@ ATF_TC_BODY(aslr_setuid, tc) for (size_t i = 1; i < nitems(bases); i++) { child = spawn_ping(tc); - bases[i] = text_base(child, "/sbin/ping"); + bases[i] = ping_text_base(child); ATF_REQUIRE_MSG(bases[i] != 0, - "failed to find /sbin/ping text segment"); + "failed to find ping text segment"); error = kill(child, SIGTERM); ATF_REQUIRE(error == 0); pid = waitpid(child, &st, 0);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a480d7a.365d9.7d118348>
