Commit dae3c5a0b7052ad7dd9fa78c51ecfab828c5007b
Committed by
Linus Torvalds
1 parent
ae424ae4b5
Exists in
master
and in
39 other branches
[PATCH] sys_unshare: remove a broken CLONE_SIGHAND code
sys_unshare(CLONE_SIGHAND) is broken, the code under 'if (new_sigh)' is never executed but very wrong. Just remove it to avoid a confusion, task_lock() has nothing to do with ->sighand changing. Also, change the comment in unshare_sighand(). Yes, CLONE_THREAD implies CLONE_SIGHAND, but still it looks confusing. Also, we don't need to check current->sighand != NULL. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 4 additions and 12 deletions Side-by-side Diff
kernel/fork.c
... | ... | @@ -1544,15 +1544,13 @@ |
1544 | 1544 | } |
1545 | 1545 | |
1546 | 1546 | /* |
1547 | - * Unsharing of sighand for tasks created with CLONE_SIGHAND is not | |
1548 | - * supported yet | |
1547 | + * Unsharing of sighand is not supported yet | |
1549 | 1548 | */ |
1550 | 1549 | static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp) |
1551 | 1550 | { |
1552 | 1551 | struct sighand_struct *sigh = current->sighand; |
1553 | 1552 | |
1554 | - if ((unshare_flags & CLONE_SIGHAND) && | |
1555 | - (sigh && atomic_read(&sigh->count) > 1)) | |
1553 | + if ((unshare_flags & CLONE_SIGHAND) && atomic_read(&sigh->count) > 1) | |
1556 | 1554 | return -EINVAL; |
1557 | 1555 | else |
1558 | 1556 | return 0; |
... | ... | @@ -1626,7 +1624,7 @@ |
1626 | 1624 | int err = 0; |
1627 | 1625 | struct fs_struct *fs, *new_fs = NULL; |
1628 | 1626 | struct namespace *ns, *new_ns = NULL; |
1629 | - struct sighand_struct *sigh, *new_sigh = NULL; | |
1627 | + struct sighand_struct *new_sigh = NULL; | |
1630 | 1628 | struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL; |
1631 | 1629 | struct files_struct *fd, *new_fd = NULL; |
1632 | 1630 | struct sem_undo_list *new_ulist = NULL; |
... | ... | @@ -1671,7 +1669,7 @@ |
1671 | 1669 | } |
1672 | 1670 | } |
1673 | 1671 | |
1674 | - if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist || | |
1672 | + if (new_fs || new_ns || new_mm || new_fd || new_ulist || | |
1675 | 1673 | new_uts || new_ipc) { |
1676 | 1674 | |
1677 | 1675 | task_lock(current); |
... | ... | @@ -1691,12 +1689,6 @@ |
1691 | 1689 | ns = current->nsproxy->namespace; |
1692 | 1690 | current->nsproxy->namespace = new_ns; |
1693 | 1691 | new_ns = ns; |
1694 | - } | |
1695 | - | |
1696 | - if (new_sigh) { | |
1697 | - sigh = current->sighand; | |
1698 | - rcu_assign_pointer(current->sighand, new_sigh); | |
1699 | - new_sigh = sigh; | |
1700 | 1692 | } |
1701 | 1693 | |
1702 | 1694 | if (new_mm) { |