Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162703033
D57734.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57734.diff
View Options
diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile
--- a/tests/sys/kern/Makefile
+++ b/tests/sys/kern/Makefile
@@ -92,6 +92,7 @@
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
--- a/tests/sys/kern/aslr.c
+++ b/tests/sys/kern/aslr.c
@@ -11,6 +11,7 @@
#include <sys/user.h>
#include <sys/wait.h>
+#include <fcntl.h>
#include <libutil.h>
#include <pwd.h>
#include <signal.h>
@@ -19,6 +20,7 @@
#include <unistd.h>
#include <atf-c.h>
+#include "freebsd_test_suite/macros.h"
/*
* Spawn an unprivileged child with ASLR force-disabled, which then execs
@@ -30,16 +32,21 @@
const char *user;
struct passwd *passwd;
pid_t child;
- int arg, error;
+ int arg, error, ctl[2];
+ char dummy;
user = atf_tc_get_config_var(tc, "unprivileged_user");
passwd = getpwnam(user);
ATF_REQUIRE(passwd != NULL);
+ ATF_REQUIRE(pipe2(ctl, O_CLOEXEC) == 0);
child = fork();
ATF_REQUIRE(child >= 0);
if (child == 0) {
- if (seteuid(passwd->pw_uid) != 0)
+ if (close(ctl[0]) != 0 ||
+ close(STDOUT_FILENO) != 0 ||
+ open("/dev/null", O_WRONLY | O_APPEND) != STDOUT_FILENO ||
+ seteuid(passwd->pw_uid) != 0)
_exit(1);
arg = PROC_ASLR_FORCE_DISABLE;
@@ -50,7 +57,9 @@
execl("/sbin/ping", "ping", "127.0.0.1", NULL);
_exit(127);
}
- usleep(500000); /* XXX-MJ */
+ ATF_REQUIRE(close(ctl[1]) == 0);
+ ATF_REQUIRE(read(ctl[0], &dummy, 1) == 0);
+ ATF_REQUIRE(close(ctl[0]) == 0);
return (child);
}
@@ -98,6 +107,7 @@
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");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 16, 11:12 PM (3 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35039864
Default Alt Text
D57734.diff (1 KB)
Attached To
Mode
D57734: tests: Fix race condition in aslr_setuid
Attached
Detach File
Event Timeline
Log In to Comment