clone(): do not allow setting CLONE_THREAD and CLONE_VM separately

XXX: When CLONE_VM is set but CLONE_THREAD is not the new thread is
meant to have its own thread group, i.e., when calling exit_group()
the cloner thread wouldn't be killed. However, this is a problem on
the Linux side because we do not invoke clone in mcexec when threads
are created. Thus, currently no support for this combination is
provided.
This commit is contained in:
bgerofi@riken.jp
2014-12-04 16:49:10 +09:00
committed by Balazs Gerofi bgerofi@riken.jp
parent 8909597499
commit b2cab453f1

View File

@ -1619,6 +1619,12 @@ unsigned long do_fork(int clone_flags, unsigned long newsp,
dkprintf("do_fork(): stack_pointr passed in: 0x%lX, stack pointer of caller: 0x%lx\n",
newsp, cursp);
if (((clone_flags & CLONE_VM) && !(clone_flags & CLONE_THREAD)) ||
(!(clone_flags & CLONE_VM) && (clone_flags & CLONE_THREAD))) {
kprintf("%s: ERROR: CLONE_VM and CLONE_THREAD should be set together\n");
return -EINVAL;
}
cpuid = obtain_clone_cpuid();
if (cpuid == -1) {