diff options
Diffstat (limited to 'kernel/fork.c')
| -rw-r--r-- | kernel/fork.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 467746b3f0aa..021e1138556e 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
| 19 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
| 20 | #include <linux/mnt_namespace.h> | ||
| 21 | #include <linux/personality.h> | 20 | #include <linux/personality.h> |
| 22 | #include <linux/mempolicy.h> | 21 | #include <linux/mempolicy.h> |
| 23 | #include <linux/sem.h> | 22 | #include <linux/sem.h> |
| @@ -427,6 +426,7 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) | |||
| 427 | init_rwsem(&mm->mmap_sem); | 426 | init_rwsem(&mm->mmap_sem); |
| 428 | INIT_LIST_HEAD(&mm->mmlist); | 427 | INIT_LIST_HEAD(&mm->mmlist); |
| 429 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; | 428 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; |
| 429 | mm->oom_adj = (current->mm) ? current->mm->oom_adj : 0; | ||
| 430 | mm->core_state = NULL; | 430 | mm->core_state = NULL; |
| 431 | mm->nr_ptes = 0; | 431 | mm->nr_ptes = 0; |
| 432 | set_mm_counter(mm, file_rss, 0); | 432 | set_mm_counter(mm, file_rss, 0); |
| @@ -568,18 +568,18 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) | |||
| 568 | * the value intact in a core dump, and to save the unnecessary | 568 | * the value intact in a core dump, and to save the unnecessary |
| 569 | * trouble otherwise. Userland only wants this done for a sys_exit. | 569 | * trouble otherwise. Userland only wants this done for a sys_exit. |
| 570 | */ | 570 | */ |
| 571 | if (tsk->clear_child_tid | 571 | if (tsk->clear_child_tid) { |
| 572 | && !(tsk->flags & PF_SIGNALED) | 572 | if (!(tsk->flags & PF_SIGNALED) && |
| 573 | && atomic_read(&mm->mm_users) > 1) { | 573 | atomic_read(&mm->mm_users) > 1) { |
| 574 | u32 __user * tidptr = tsk->clear_child_tid; | 574 | /* |
| 575 | * We don't check the error code - if userspace has | ||
| 576 | * not set up a proper pointer then tough luck. | ||
| 577 | */ | ||
| 578 | put_user(0, tsk->clear_child_tid); | ||
| 579 | sys_futex(tsk->clear_child_tid, FUTEX_WAKE, | ||
| 580 | 1, NULL, NULL, 0); | ||
| 581 | } | ||
| 575 | tsk->clear_child_tid = NULL; | 582 | tsk->clear_child_tid = NULL; |
| 576 | |||
| 577 | /* | ||
| 578 | * We don't check the error code - if userspace has | ||
| 579 | * not set up a proper pointer then tough luck. | ||
| 580 | */ | ||
| 581 | put_user(0, tidptr); | ||
| 582 | sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0); | ||
| 583 | } | 583 | } |
| 584 | } | 584 | } |
| 585 | 585 | ||
| @@ -1269,6 +1269,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1269 | write_unlock_irq(&tasklist_lock); | 1269 | write_unlock_irq(&tasklist_lock); |
| 1270 | proc_fork_connector(p); | 1270 | proc_fork_connector(p); |
| 1271 | cgroup_post_fork(p); | 1271 | cgroup_post_fork(p); |
| 1272 | perf_counter_fork(p); | ||
| 1272 | return p; | 1273 | return p; |
| 1273 | 1274 | ||
| 1274 | bad_fork_free_pid: | 1275 | bad_fork_free_pid: |
| @@ -1408,12 +1409,6 @@ long do_fork(unsigned long clone_flags, | |||
| 1408 | if (clone_flags & CLONE_VFORK) { | 1409 | if (clone_flags & CLONE_VFORK) { |
| 1409 | p->vfork_done = &vfork; | 1410 | p->vfork_done = &vfork; |
| 1410 | init_completion(&vfork); | 1411 | init_completion(&vfork); |
| 1411 | } else if (!(clone_flags & CLONE_VM)) { | ||
| 1412 | /* | ||
| 1413 | * vfork will do an exec which will call | ||
| 1414 | * set_task_comm() | ||
| 1415 | */ | ||
| 1416 | perf_counter_fork(p); | ||
| 1417 | } | 1412 | } |
| 1418 | 1413 | ||
| 1419 | audit_finish_fork(p); | 1414 | audit_finish_fork(p); |
