8#include "pedigree/kernel/Log.h"
15extern "C" int posixCloneRouteForTest(
unsigned long flags);
17bool runHostedCloneRoutingRegressions(
Process*) {
18 const unsigned long spawnFlags = CLONE_VM | CLONE_VFORK | SIGCHLD;
19 const unsigned long pthreadFlags = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
20 CLONE_THREAD | CLONE_SYSVSEM | CLONE_SETTLS |
21 CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | CLONE_DETACHED;
24 posixCloneRouteForTest(spawnFlags) == 2 && posixCloneRouteForTest(pthreadFlags) == 1 &&
25 posixCloneRouteForTest(spawnFlags | CLONE_NEWUTS) == 2 &&
26 posixCloneRouteForTest(spawnFlags | CLONE_PARENT_SETTID | CLONE_CHILD_SETTID |
27 CLONE_CHILD_CLEARTID | CLONE_SETTLS) == 2 &&
28 posixCloneRouteForTest(0) == 0 && posixCloneRouteForTest(SIGCHLD) == 0 &&
29 posixCloneRouteForTest(SIGCHLD | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID) == 0 &&
30 posixCloneRouteForTest(CLONE_NEWUTS | SIGCHLD) == 0 &&
31 posixCloneRouteForTest(CLONE_NEWUTS | CLONE_NEWNS | SIGCHLD) == -1 &&
32 posixCloneRouteForTest(CLONE_NEWUTS | pthreadFlags) == -1 &&
33 posixCloneRouteForTest(CLONE_VM) == -1 && posixCloneRouteForTest(CLONE_THREAD) == -1 &&
34 posixCloneRouteForTest(CLONE_VM | CLONE_THREAD) == -1 &&
35 posixCloneRouteForTest(CLONE_VM | CLONE_SIGHAND | CLONE_THREAD) == -1 &&
36 posixCloneRouteForTest(CLONE_SIGHAND) == -1 &&
37 posixCloneRouteForTest(CLONE_VFORK | SIGCHLD) == -1 &&
38 posixCloneRouteForTest(spawnFlags | CLONE_FILES) == -1 &&
39 posixCloneRouteForTest(CLONE_FILES | SIGCHLD) == -1 &&
40 posixCloneRouteForTest(CLONE_PARENT | SIGCHLD) == -1;
43 "HOSTED-SYSCALL-TEST: FAIL clone-process-routing: "
44 "fork, vfork, and pthread clone no longer take distinct paths");
48 NOTICE(
"HOSTED-SYSCALL-TEST: PASS clone-process-routing");