git: 478d81e72eaa - stable/14 - tests/aslr: Fix spurious test failures
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 07 Jul 2026 20:57:59 UTC
The branch stable/14 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=478d81e72eaae3276c4670e0054385b5e4e1f031
commit 478d81e72eaae3276c4670e0054385b5e4e1f031
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-03 19:28:22 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-07-07 07:08:03 +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")
(cherry picked from commit 81cf9a0ca765b48a430da61c221be17c4d0f753a)
---
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);