Skip to contentSkip to conversation

check_unshare_flags: kill the bogus CLONE_SIGHAND/sig->count check

PATCH In review Oleg Nesterov 2 participants 2 messages Mar 21, 2010 – Apr 9, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 check_unshare_flags: kill the bogus CLONE_SIGHAND/sig->count check

check_unshare_flags(CLONE_SIGHAND) adds CLONE_THREAD to *flags_ptr if the task is multithreaded to ensure unshare_thread() will fail.

Not only this is a bit strange way to return the error, this is absolutely meaningless. If signal->count > 1 then sighand->count must be also > 1, and unshare_sighand() will fail anyway.

In fact, all CLONE_THREAD/SIGHAND/VM checks inside sys_unshare() do not look right. Fortunately this code doesn't really work anyway.

---

 kernel/fork.c |    8 --------
 1 file changed, 8 deletions(-)
kernel/fork.c renamed from kernel/fork.c~UNSHARE_DONT_USE_SIG_COUNT +0 -8
@@ -1519,14 +1519,6 @@ static void check_unshare_flags(unsigned
 		*flags_ptr |= CLONE_SIGHAND;
 
 	/*
-	 * If unsharing signal handlers and the task was created
-	 * using CLONE_THREAD, then must unshare the thread
-	 */
-	if ((*flags_ptr & CLONE_SIGHAND) &&
-	    (atomic_read(&current->signal->count) > 1))
-		*flags_ptr |= CLONE_THREAD;
-
-	/*
 	 * If unsharing namespace, must also unshare filesystem information.
 	 */
 	if (*flags_ptr & CLONE_NEWNS)