aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@hera.kernel.org>2006-03-23 09:39:08 -0500
committerAnton Altaparmakov <aia21@hera.kernel.org>2006-03-23 09:39:08 -0500
commit74293759002aa7db0179158c20676a034614577b (patch)
tree030ef62361042d1a034087ad9a726db3b57bba72 /kernel/fork.c
parentbb8047d3540affd6b8c2adac3fe792e07143be0f (diff)
parent2e6e33bab6e1996a5dec9108fb467b52b841e7a8 (diff)
Merge branch 'master' of /home/aia21/ntfs-2.6/
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index fbea12d7a943..9bd7b65ee418 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;
@@ -1528,6 +1534,12 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1528 1534
1529 check_unshare_flags(&unshare_flags); 1535 check_unshare_flags(&unshare_flags);
1530 1536
1537 /* Return -EINVAL for all unsupported flags */
1538 err = -EINVAL;
1539 if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
1540 CLONE_VM|CLONE_FILES|CLONE_SYSVSEM))
1541 goto bad_unshare_out;
1542
1531 if ((err = unshare_thread(unshare_flags))) 1543 if ((err = unshare_thread(unshare_flags)))
1532 goto bad_unshare_out; 1544 goto bad_unshare_out;
1533 if ((err = unshare_fs(unshare_flags, &new_fs))) 1545 if ((err = unshare_fs(unshare_flags, &new_fs)))
@@ -1561,7 +1573,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1561 1573
1562 if (new_sigh) { 1574 if (new_sigh) {
1563 sigh = current->sighand; 1575 sigh = current->sighand;
1564 current->sighand = new_sigh; 1576 rcu_assign_pointer(current->sighand, new_sigh);
1565 new_sigh = sigh; 1577 new_sigh = sigh;
1566 } 1578 }
1567 1579