*/
static size_t mfd_def_size = MFD_DEF_SIZE;
static const char *memfd_str = MEMFD_STR;
+static pid_t spawn_newpid_thread(unsigned int flags, int (*fn)(void *));
+static int newpid_thread_fn2(void *arg);
+static void join_newpid_thread(pid_t pid);
static ssize_t fd2name(int fd, char *buf, size_t bufsize)
{
static void test_sysctl_child(void)
{
int fd;
+ int pid;
printf("%s sysctl 0\n", memfd_str);
sysctl_assert_write("0");
mfd_def_size,
MFD_CLOEXEC | MFD_ALLOW_SEALING);
+ printf("%s child ns\n", memfd_str);
+ pid = spawn_newpid_thread(CLONE_NEWPID, newpid_thread_fn2);
+ join_newpid_thread(pid);
+
mfd_assert_mode(fd, 0666);
mfd_assert_has_seals(fd, F_SEAL_EXEC);
mfd_fail_chmod(fd, 0777);
int pid = spawn_newpid_thread(CLONE_NEWPID, newpid_thread_fn);
join_newpid_thread(pid);
-
- printf("%s child ns\n", memfd_str);
- sysctl_assert_write("1");
-
- pid = spawn_newpid_thread(CLONE_NEWPID, newpid_thread_fn2);
- join_newpid_thread(pid);
}
/*