JANAK DESAI <janak@xxxxxxxxxx> writes:unshare is doing the reverse of what clone does. So if you are unsharing namespace
[PATCH -mm 1/9] unshare system call: system call handler function
sys_unshare system call handler function accepts the same flags as
clone system call, checks constraints on each of the flags and invokes
corresponding unshare functions to disassociate respective process
context if it was being shared with another task.
Changes since the first submission of this patch on 12/12/05:
- Moved cleaning up of old shared structures outside of the
block that holds task_lock (12/13/05)
Signed-off-by: Janak Desai <janak@xxxxxxxxxx>
---
fork.c | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 232 insertions(+)
diff -Naurp 2.6.15-rc5-mm2/kernel/fork.c 2.6.15-rc5-mm2+patch/kernel/fork.c
--- 2.6.15-rc5-mm2/kernel/fork.c 2005-12-12 03:05:59.000000000 +0000
+++ 2.6.15-rc5-mm2+patch/kernel/fork.c 2005-12-13 18:38:26.000000000 +0000
@@ -1330,3 +1330,235 @@ void __init proc_caches_init(void)
sizeof(struct mm_struct), 0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
}
+
+
+/*
+ * Check constraints on flags passed to the unshare system call and
+ * force unsharing of additional process context as appropriate.
+ */
If it isn't legal how about we deny the unshare call.
Then we can share this code with clone.
Eric