aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 913284e3db14..4a9b318dad0d 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -405,6 +405,18 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
405#define allocate_mm() (kmem_cache_alloc(mm_cachep, GFP_KERNEL)) 405#define allocate_mm() (kmem_cache_alloc(mm_cachep, GFP_KERNEL))
406#define free_mm(mm) (kmem_cache_free(mm_cachep, (mm))) 406#define free_mm(mm) (kmem_cache_free(mm_cachep, (mm)))
407 407
408static unsigned long default_dump_filter = MMF_DUMP_FILTER_DEFAULT;
409
410static int __init coredump_filter_setup(char *s)
411{
412 default_dump_filter =
413 (simple_strtoul(s, NULL, 0) << MMF_DUMP_FILTER_SHIFT) &
414 MMF_DUMP_FILTER_MASK;
415 return 1;
416}
417
418__setup("coredump_filter=", coredump_filter_setup);
419
408#include <linux/init_task.h> 420#include <linux/init_task.h>
409 421
410static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) 422static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
@@ -413,8 +425,7 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
413 atomic_set(&mm->mm_count, 1); 425 atomic_set(&mm->mm_count, 1);
414 init_rwsem(&mm->mmap_sem); 426 init_rwsem(&mm->mmap_sem);
415 INIT_LIST_HEAD(&mm->mmlist); 427 INIT_LIST_HEAD(&mm->mmlist);
416 mm->flags = (current->mm) ? current->mm->flags 428 mm->flags = (current->mm) ? current->mm->flags : default_dump_filter;
417 : MMF_DUMP_FILTER_DEFAULT;
418 mm->core_state = NULL; 429 mm->core_state = NULL;
419 mm->nr_ptes = 0; 430 mm->nr_ptes = 0;
420 set_mm_counter(mm, file_rss, 0); 431 set_mm_counter(mm, file_rss, 0);
@@ -763,7 +774,7 @@ static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk)
763{ 774{
764 struct sighand_struct *sig; 775 struct sighand_struct *sig;
765 776
766 if (clone_flags & (CLONE_SIGHAND | CLONE_THREAD)) { 777 if (clone_flags & CLONE_SIGHAND) {
767 atomic_inc(&current->sighand->count); 778 atomic_inc(&current->sighand->count);
768 return 0; 779 return 0;
769 } 780 }
@@ -1120,12 +1131,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1120 1131
1121 if (pid != &init_struct_pid) { 1132 if (pid != &init_struct_pid) {
1122 retval = -ENOMEM; 1133 retval = -ENOMEM;
1123 pid = alloc_pid(task_active_pid_ns(p)); 1134 pid = alloc_pid(p->nsproxy->pid_ns);
1124 if (!pid) 1135 if (!pid)
1125 goto bad_fork_cleanup_io; 1136 goto bad_fork_cleanup_io;
1126 1137
1127 if (clone_flags & CLONE_NEWPID) { 1138 if (clone_flags & CLONE_NEWPID) {
1128 retval = pid_ns_prepare_proc(task_active_pid_ns(p)); 1139 retval = pid_ns_prepare_proc(p->nsproxy->pid_ns);
1129 if (retval < 0) 1140 if (retval < 0)
1130 goto bad_fork_free_pid; 1141 goto bad_fork_free_pid;
1131 } 1142 }
@@ -1475,12 +1486,10 @@ void __init proc_caches_init(void)
1475 fs_cachep = kmem_cache_create("fs_cache", 1486 fs_cachep = kmem_cache_create("fs_cache",
1476 sizeof(struct fs_struct), 0, 1487 sizeof(struct fs_struct), 0,
1477 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 1488 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
1478 vm_area_cachep = kmem_cache_create("vm_area_struct",
1479 sizeof(struct vm_area_struct), 0,
1480 SLAB_PANIC, NULL);
1481 mm_cachep = kmem_cache_create("mm_struct", 1489 mm_cachep = kmem_cache_create("mm_struct",
1482 sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, 1490 sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,
1483 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 1491 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
1492 mmap_init();
1484} 1493}
1485 1494
1486/* 1495/*