check_unshare_flags: kill the bogus CLONE_SIGHAND/sig->count check
authorOleg Nesterov <[email protected]>
Wed, 26 May 2010 21:43:21 +0000 (14:43 -0700)
committerLinus Torvalds <[email protected]>
Thu, 27 May 2010 16:12:47 +0000 (09:12 -0700)
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.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Balbir Singh <[email protected]>
Acked-by: Roland McGrath <[email protected]>
Cc: Veaceslav Falico <[email protected]>
Cc: Stanislaw Gruszka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/fork.c

index 7701470ea1b8222eb5990a016b85fc8526d3d55f..40cd099cfc1b5e53f77061b84a4832d5ed4feae1 100644 (file)
@@ -1517,14 +1517,6 @@ static void check_unshare_flags(unsigned long *flags_ptr)
        if (*flags_ptr & CLONE_VM)
                *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.
         */