diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index c4f38a849436..b9372a0bff18 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -193,6 +193,7 @@ void __put_task_struct(struct task_struct *tsk) | |||
193 | WARN_ON(atomic_read(&tsk->usage)); | 193 | WARN_ON(atomic_read(&tsk->usage)); |
194 | WARN_ON(tsk == current); | 194 | WARN_ON(tsk == current); |
195 | 195 | ||
196 | security_task_free(tsk); | ||
196 | exit_creds(tsk); | 197 | exit_creds(tsk); |
197 | delayacct_tsk_free(tsk); | 198 | delayacct_tsk_free(tsk); |
198 | put_signal_struct(tsk->signal); | 199 | put_signal_struct(tsk->signal); |
@@ -355,7 +356,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) | |||
355 | charge = 0; | 356 | charge = 0; |
356 | if (mpnt->vm_flags & VM_ACCOUNT) { | 357 | if (mpnt->vm_flags & VM_ACCOUNT) { |
357 | unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; | 358 | unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; |
358 | if (security_vm_enough_memory(len)) | 359 | if (security_vm_enough_memory_mm(oldmm, len)) /* sic */ |
359 | goto fail_nomem; | 360 | goto fail_nomem; |
360 | charge = len; | 361 | charge = len; |
361 | } | 362 | } |
@@ -511,6 +512,23 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p) | |||
511 | return NULL; | 512 | return NULL; |
512 | } | 513 | } |
513 | 514 | ||
515 | static void check_mm(struct mm_struct *mm) | ||
516 | { | ||
517 | int i; | ||
518 | |||
519 | for (i = 0; i < NR_MM_COUNTERS; i++) { | ||
520 | long x = atomic_long_read(&mm->rss_stat.count[i]); | ||
521 | |||
522 | if (unlikely(x)) | ||
523 | printk(KERN_ALERT "BUG: Bad rss-counter state " | ||
524 | "mm:%p idx:%d val:%ld\n", mm, i, x); | ||
525 | } | ||
526 | |||
527 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
528 | VM_BUG_ON(mm->pmd_huge_pte); | ||
529 | #endif | ||
530 | } | ||
531 | |||
514 | /* | 532 | /* |
515 | * Allocate and initialize an mm_struct. | 533 | * Allocate and initialize an mm_struct. |
516 | */ | 534 | */ |
@@ -538,9 +556,7 @@ void __mmdrop(struct mm_struct *mm) | |||
538 | mm_free_pgd(mm); | 556 | mm_free_pgd(mm); |
539 | destroy_context(mm); | 557 | destroy_context(mm); |
540 | mmu_notifier_mm_destroy(mm); | 558 | mmu_notifier_mm_destroy(mm); |
541 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 559 | check_mm(mm); |
542 | VM_BUG_ON(mm->pmd_huge_pte); | ||
543 | #endif | ||
544 | free_mm(mm); | 560 | free_mm(mm); |
545 | } | 561 | } |
546 | EXPORT_SYMBOL_GPL(__mmdrop); | 562 | EXPORT_SYMBOL_GPL(__mmdrop); |
@@ -1035,6 +1051,9 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
1035 | sig->oom_score_adj = current->signal->oom_score_adj; | 1051 | sig->oom_score_adj = current->signal->oom_score_adj; |
1036 | sig->oom_score_adj_min = current->signal->oom_score_adj_min; | 1052 | sig->oom_score_adj_min = current->signal->oom_score_adj_min; |
1037 | 1053 | ||
1054 | sig->has_child_subreaper = current->signal->has_child_subreaper || | ||
1055 | current->signal->is_child_subreaper; | ||
1056 | |||
1038 | mutex_init(&sig->cred_guard_mutex); | 1057 | mutex_init(&sig->cred_guard_mutex); |
1039 | 1058 | ||
1040 | return 0; | 1059 | return 0; |
@@ -1222,6 +1241,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1222 | #ifdef CONFIG_CPUSETS | 1241 | #ifdef CONFIG_CPUSETS |
1223 | p->cpuset_mem_spread_rotor = NUMA_NO_NODE; | 1242 | p->cpuset_mem_spread_rotor = NUMA_NO_NODE; |
1224 | p->cpuset_slab_spread_rotor = NUMA_NO_NODE; | 1243 | p->cpuset_slab_spread_rotor = NUMA_NO_NODE; |
1244 | seqcount_init(&p->mems_allowed_seq); | ||
1225 | #endif | 1245 | #endif |
1226 | #ifdef CONFIG_TRACE_IRQFLAGS | 1246 | #ifdef CONFIG_TRACE_IRQFLAGS |
1227 | p->irq_events = 0; | 1247 | p->irq_events = 0; |