diff -Naur linux-3.8/init/Kconfig option2/init/Kconfig --- linux-3.8/init/Kconfig 2013-02-19 10:28:34.000000000 +1030 +++ option2/init/Kconfig 2013-02-24 13:57:02.000000000 +1030 @@ -991,6 +991,7 @@ config CHECKPOINT_RESTORE bool "Checkpoint/restore support" if EXPERT default n + select MM_FIELDS_SETTING help Enables additional kernel features in a sake of checkpoint/restore. In particular it adds auxiliary prctl codes to setup process text, @@ -999,6 +1000,22 @@ If unsure, say N here. +config MM_FIELDS_SETTING + bool "Allow modifying per-process memory-region fields" + default y + help + Support "prctl(PR_SET_MM)" which allows applications to modify + the following in their "mm_struct": + + start_code, end_code, start_data, end_data, start_brk, brk, + start_stack, arg_start, arg_end, env_start, env_end. + + Also to modify their executable file ("/proc/self/exe"). + + This option is needed for reconstructing processes (such as when + restoring a process from a checkpoint; duplicating a process; + or migrating it to another computer). + menuconfig NAMESPACES bool "Namespaces support" if EXPERT default !EXPERT diff -Naur linux-3.8/kernel/sys.c option2/kernel/sys.c --- linux-3.8/kernel/sys.c 2013-02-19 10:28:34.000000000 +1030 +++ option2/kernel/sys.c 2013-02-24 10:37:08.000000000 +1030 @@ -1788,7 +1788,7 @@ return mask; } -#ifdef CONFIG_CHECKPOINT_RESTORE +#ifdef CONFIG_MM_FIELDS_SETTING static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) { struct fd exe; @@ -1981,18 +1981,22 @@ up_read(&mm->mmap_sem); return error; } +#else /* CONFIG_MM_FIELDS_SETTING */ -static int prctl_get_tid_address(struct task_struct *me, int __user **tid_addr) -{ - return put_user(me->clear_child_tid, tid_addr); -} - -#else /* CONFIG_CHECKPOINT_RESTORE */ static int prctl_set_mm(int opt, unsigned long addr, unsigned long arg4, unsigned long arg5) { return -EINVAL; } +#endif + +#ifdef CONFIG_CHECKPOINT_RESTORE +static int prctl_get_tid_address(struct task_struct *me, int __user **tid_addr) +{ + return put_user(me->clear_child_tid, tid_addr); +} + +#else static int prctl_get_tid_address(struct task_struct *me, int __user **tid_addr) { return -EINVAL;