aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index fbea12d7a943..b373322ca497 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -108,8 +108,10 @@ void free_task(struct task_struct *tsk)
108} 108}
109EXPORT_SYMBOL(free_task); 109EXPORT_SYMBOL(free_task);
110 110
111void __put_task_struct(struct task_struct *tsk) 111void __put_task_struct_cb(struct rcu_head *rhp)
112{ 112{
113 struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
114
113 WARN_ON(!(tsk->exit_state & (EXIT_DEAD | EXIT_ZOMBIE))); 115 WARN_ON(!(tsk->exit_state & (EXIT_DEAD | EXIT_ZOMBIE)));
114 WARN_ON(atomic_read(&tsk->usage)); 116 WARN_ON(atomic_read(&tsk->usage));
115 WARN_ON(tsk == current); 117 WARN_ON(tsk == current);
@@ -1060,6 +1062,12 @@ static task_t *copy_process(unsigned long clone_flags,
1060 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL; 1062 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
1061 1063
1062 /* 1064 /*
1065 * sigaltstack should be cleared when sharing the same VM
1066 */
1067 if ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM)
1068 p->sas_ss_sp = p->sas_ss_size = 0;
1069
1070 /*
1063 * Syscall tracing should be turned off in the child regardless 1071 * Syscall tracing should be turned off in the child regardless
1064 * of CLONE_PTRACE. 1072 * of CLONE_PTRACE.
1065 */ 1073 */
@@ -1470,9 +1478,7 @@ static int unshare_vm(unsigned long unshare_flags, struct mm_struct **new_mmp)
1470 1478
1471 if ((unshare_flags & CLONE_VM) && 1479 if ((unshare_flags & CLONE_VM) &&
1472 (mm && atomic_read(&mm->mm_users) > 1)) { 1480 (mm && atomic_read(&mm->mm_users) > 1)) {
1473 *new_mmp = dup_mm(current); 1481 return -EINVAL;
1474 if (!*new_mmp)
1475 return -ENOMEM;
1476 } 1482 }
1477 1483
1478 return 0; 1484 return 0;
@@ -1561,7 +1567,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1561 1567
1562 if (new_sigh) { 1568 if (new_sigh) {
1563 sigh = current->sighand; 1569 sigh = current->sighand;
1564 current->sighand = new_sigh; 1570 rcu_assign_pointer(current->sighand, new_sigh);
1565 new_sigh = sigh; 1571 new_sigh = sigh;
1566 } 1572 }
1567 1573