aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 2c8857e12855..1cd7d581b3b2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -330,6 +330,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
330 tsk->btrace_seq = 0; 330 tsk->btrace_seq = 0;
331#endif 331#endif
332 tsk->splice_pipe = NULL; 332 tsk->splice_pipe = NULL;
333 tsk->task_frag.page = NULL;
333 334
334 account_kernel_stack(ti, 1); 335 account_kernel_stack(ti, 1);
335 336
@@ -353,6 +354,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
353 354
354 down_write(&oldmm->mmap_sem); 355 down_write(&oldmm->mmap_sem);
355 flush_cache_dup_mm(oldmm); 356 flush_cache_dup_mm(oldmm);
357 uprobe_dup_mmap(oldmm, mm);
356 /* 358 /*
357 * Not linked in yet - no deadlock potential: 359 * Not linked in yet - no deadlock potential:
358 */ 360 */
@@ -421,7 +423,12 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
421 mapping->i_mmap_writable++; 423 mapping->i_mmap_writable++;
422 flush_dcache_mmap_lock(mapping); 424 flush_dcache_mmap_lock(mapping);
423 /* insert tmp into the share list, just after mpnt */ 425 /* insert tmp into the share list, just after mpnt */
424 vma_prio_tree_add(tmp, mpnt); 426 if (unlikely(tmp->vm_flags & VM_NONLINEAR))
427 vma_nonlinear_insert(tmp,
428 &mapping->i_mmap_nonlinear);
429 else
430 vma_interval_tree_insert_after(tmp, mpnt,
431 &mapping->i_mmap);
425 flush_dcache_mmap_unlock(mapping); 432 flush_dcache_mmap_unlock(mapping);
426 mutex_unlock(&mapping->i_mmap_mutex); 433 mutex_unlock(&mapping->i_mmap_mutex);
427 } 434 }
@@ -454,9 +461,6 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
454 461
455 if (retval) 462 if (retval)
456 goto out; 463 goto out;
457
458 if (file)
459 uprobe_mmap(tmp);
460 } 464 }
461 /* a new mm has just been created */ 465 /* a new mm has just been created */
462 arch_dup_mmap(oldmm, mm); 466 arch_dup_mmap(oldmm, mm);
@@ -623,26 +627,6 @@ void mmput(struct mm_struct *mm)
623} 627}
624EXPORT_SYMBOL_GPL(mmput); 628EXPORT_SYMBOL_GPL(mmput);
625 629
626/*
627 * We added or removed a vma mapping the executable. The vmas are only mapped
628 * during exec and are not mapped with the mmap system call.
629 * Callers must hold down_write() on the mm's mmap_sem for these
630 */
631void added_exe_file_vma(struct mm_struct *mm)
632{
633 mm->num_exe_file_vmas++;
634}
635
636void removed_exe_file_vma(struct mm_struct *mm)
637{
638 mm->num_exe_file_vmas--;
639 if ((mm->num_exe_file_vmas == 0) && mm->exe_file) {
640 fput(mm->exe_file);
641 mm->exe_file = NULL;
642 }
643
644}
645
646void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file) 630void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
647{ 631{
648 if (new_exe_file) 632 if (new_exe_file)
@@ -650,15 +634,13 @@ void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
650 if (mm->exe_file) 634 if (mm->exe_file)
651 fput(mm->exe_file); 635 fput(mm->exe_file);
652 mm->exe_file = new_exe_file; 636 mm->exe_file = new_exe_file;
653 mm->num_exe_file_vmas = 0;
654} 637}
655 638
656struct file *get_mm_exe_file(struct mm_struct *mm) 639struct file *get_mm_exe_file(struct mm_struct *mm)
657{ 640{
658 struct file *exe_file; 641 struct file *exe_file;
659 642
660 /* We need mmap_sem to protect against races with removal of 643 /* We need mmap_sem to protect against races with removal of exe_file */
661 * VM_EXECUTABLE vmas */
662 down_read(&mm->mmap_sem); 644 down_read(&mm->mmap_sem);
663 exe_file = mm->exe_file; 645 exe_file = mm->exe_file;
664 if (exe_file) 646 if (exe_file)
@@ -839,8 +821,6 @@ struct mm_struct *dup_mm(struct task_struct *tsk)
839#ifdef CONFIG_TRANSPARENT_HUGEPAGE 821#ifdef CONFIG_TRANSPARENT_HUGEPAGE
840 mm->pmd_huge_pte = NULL; 822 mm->pmd_huge_pte = NULL;
841#endif 823#endif
842 uprobe_reset_state(mm);
843
844 if (!mm_init(mm, tsk)) 824 if (!mm_init(mm, tsk))
845 goto fail_nomem; 825 goto fail_nomem;
846 826
@@ -1081,7 +1061,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
1081 init_rwsem(&sig->group_rwsem); 1061 init_rwsem(&sig->group_rwsem);
1082#endif 1062#endif
1083 1063
1084 sig->oom_adj = current->signal->oom_adj;
1085 sig->oom_score_adj = current->signal->oom_score_adj; 1064 sig->oom_score_adj = current->signal->oom_score_adj;
1086 sig->oom_score_adj_min = current->signal->oom_score_adj_min; 1065 sig->oom_score_adj_min = current->signal->oom_score_adj_min;
1087 1066
@@ -1280,11 +1259,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1280#endif 1259#endif
1281#ifdef CONFIG_TRACE_IRQFLAGS 1260#ifdef CONFIG_TRACE_IRQFLAGS
1282 p->irq_events = 0; 1261 p->irq_events = 0;
1283#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
1284 p->hardirqs_enabled = 1;
1285#else
1286 p->hardirqs_enabled = 0; 1262 p->hardirqs_enabled = 0;
1287#endif
1288 p->hardirq_enable_ip = 0; 1263 p->hardirq_enable_ip = 0;
1289 p->hardirq_enable_event = 0; 1264 p->hardirq_enable_event = 0;
1290 p->hardirq_disable_ip = _THIS_IP_; 1265 p->hardirq_disable_ip = _THIS_IP_;