mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
kernel: Update elf handling to not unlink thread from parent
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
e9075241e1
commit
a97985ce95
@ -16,11 +16,31 @@ v2: (from Andrew Vagin)
|
||||
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
|
||||
Signed-off-by: Andrew Vagin <avagin@openvz.org>
|
||||
---
|
||||
arch/x86/ia32/ia32_aout.c | 2
|
||||
arch/x86/include/asm/elf.h | 3
|
||||
arch/x86/vdso/vma.c | 22 ++
|
||||
fs/binfmt_elf.c | 405 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||
fs/binfmt_aout.c | 2
|
||||
fs/binfmt_elf.c | 407 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||
fs/binfmt_elf_fdpic.c | 2
|
||||
fs/binfmt_flat.c | 2
|
||||
fs/binfmt_som.c | 2
|
||||
fs/exec.c | 10 -
|
||||
include/linux/binfmts.h | 2
|
||||
include/linux/elf_ckpt.h | 127 ++++++++++++++
|
||||
4 files changed, 555 insertions(+), 2 deletions(-)
|
||||
11 files changed, 568 insertions(+), 13 deletions(-)
|
||||
|
||||
Index: linux-2.6.git/arch/x86/ia32/ia32_aout.c
|
||||
===================================================================
|
||||
--- linux-2.6.git.orig/arch/x86/ia32/ia32_aout.c
|
||||
+++ linux-2.6.git/arch/x86/ia32/ia32_aout.c
|
||||
@@ -291,7 +291,7 @@ static int load_aout_binary(struct linux
|
||||
return -ENOMEM;
|
||||
|
||||
/* Flush all traces of the currently running executable */
|
||||
- retval = flush_old_exec(bprm);
|
||||
+ retval = flush_old_exec(bprm, true);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
Index: linux-2.6.git/arch/x86/include/asm/elf.h
|
||||
===================================================================
|
||||
@ -69,6 +89,19 @@ Index: linux-2.6.git/arch/x86/vdso/vma.c
|
||||
static __init int vdso_setup(char *s)
|
||||
{
|
||||
vdso_enabled = simple_strtoul(s, NULL, 0);
|
||||
Index: linux-2.6.git/fs/binfmt_aout.c
|
||||
===================================================================
|
||||
--- linux-2.6.git.orig/fs/binfmt_aout.c
|
||||
+++ linux-2.6.git/fs/binfmt_aout.c
|
||||
@@ -238,7 +238,7 @@ static int load_aout_binary(struct linux
|
||||
return -ENOMEM;
|
||||
|
||||
/* Flush all traces of the currently running executable */
|
||||
- retval = flush_old_exec(bprm);
|
||||
+ retval = flush_old_exec(bprm, true);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
Index: linux-2.6.git/fs/binfmt_elf.c
|
||||
===================================================================
|
||||
--- linux-2.6.git.orig/fs/binfmt_elf.c
|
||||
@ -154,7 +187,7 @@ Index: linux-2.6.git/fs/binfmt_elf.c
|
||||
+ }
|
||||
+
|
||||
+ /* Flush all traces of the currently running executable */
|
||||
+ ret = flush_old_exec(bprm);
|
||||
+ ret = flush_old_exec(bprm, false);
|
||||
+ if (ret)
|
||||
+ goto out;
|
||||
+
|
||||
@ -506,6 +539,95 @@ Index: linux-2.6.git/fs/binfmt_elf.c
|
||||
elf_ppnt = elf_phdata;
|
||||
elf_bss = 0;
|
||||
elf_brk = 0;
|
||||
@@ -707,7 +1110,7 @@ static int load_elf_binary(struct linux_
|
||||
}
|
||||
|
||||
/* Flush all traces of the currently running executable */
|
||||
- retval = flush_old_exec(bprm);
|
||||
+ retval = flush_old_exec(bprm, true);
|
||||
if (retval)
|
||||
goto out_free_dentry;
|
||||
|
||||
Index: linux-2.6.git/fs/binfmt_elf_fdpic.c
|
||||
===================================================================
|
||||
--- linux-2.6.git.orig/fs/binfmt_elf_fdpic.c
|
||||
+++ linux-2.6.git/fs/binfmt_elf_fdpic.c
|
||||
@@ -311,7 +311,7 @@ static int load_elf_fdpic_binary(struct
|
||||
interp_params.flags |= ELF_FDPIC_FLAG_CONSTDISP;
|
||||
|
||||
/* flush all traces of the currently running executable */
|
||||
- retval = flush_old_exec(bprm);
|
||||
+ retval = flush_old_exec(bprm, true);
|
||||
if (retval)
|
||||
goto error;
|
||||
|
||||
Index: linux-2.6.git/fs/binfmt_flat.c
|
||||
===================================================================
|
||||
--- linux-2.6.git.orig/fs/binfmt_flat.c
|
||||
+++ linux-2.6.git/fs/binfmt_flat.c
|
||||
@@ -514,7 +514,7 @@ static int load_flat_file(struct linux_b
|
||||
|
||||
/* Flush all traces of the currently running executable */
|
||||
if (id == 0) {
|
||||
- result = flush_old_exec(bprm);
|
||||
+ result = flush_old_exec(bprm, true);
|
||||
if (result) {
|
||||
ret = result;
|
||||
goto err;
|
||||
Index: linux-2.6.git/fs/binfmt_som.c
|
||||
===================================================================
|
||||
--- linux-2.6.git.orig/fs/binfmt_som.c
|
||||
+++ linux-2.6.git/fs/binfmt_som.c
|
||||
@@ -220,7 +220,7 @@ load_som_binary(struct linux_binprm * bp
|
||||
}
|
||||
|
||||
/* Flush all traces of the currently running executable */
|
||||
- retval = flush_old_exec(bprm);
|
||||
+ retval = flush_old_exec(bprm, true);
|
||||
if (retval)
|
||||
goto out_free;
|
||||
|
||||
Index: linux-2.6.git/fs/exec.c
|
||||
===================================================================
|
||||
--- linux-2.6.git.orig/fs/exec.c
|
||||
+++ linux-2.6.git/fs/exec.c
|
||||
@@ -1071,7 +1071,7 @@ void set_task_comm(struct task_struct *t
|
||||
perf_event_comm(tsk);
|
||||
}
|
||||
|
||||
-int flush_old_exec(struct linux_binprm * bprm)
|
||||
+int flush_old_exec(struct linux_binprm *bprm, bool unlink_thread)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -1079,9 +1079,11 @@ int flush_old_exec(struct linux_binprm *
|
||||
* Make sure we have a private signal table and that
|
||||
* we are unassociated from the previous thread group.
|
||||
*/
|
||||
- retval = de_thread(current);
|
||||
- if (retval)
|
||||
- goto out;
|
||||
+ if (unlink_thread) {
|
||||
+ retval = de_thread(current);
|
||||
+ if (retval)
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
set_mm_exe_file(bprm->mm, bprm->file);
|
||||
|
||||
Index: linux-2.6.git/include/linux/binfmts.h
|
||||
===================================================================
|
||||
--- linux-2.6.git.orig/include/linux/binfmts.h
|
||||
+++ linux-2.6.git/include/linux/binfmts.h
|
||||
@@ -109,7 +109,7 @@ extern void unregister_binfmt(struct lin
|
||||
extern int prepare_binprm(struct linux_binprm *);
|
||||
extern int __must_check remove_arg_zero(struct linux_binprm *);
|
||||
extern int search_binary_handler(struct linux_binprm *, struct pt_regs *);
|
||||
-extern int flush_old_exec(struct linux_binprm * bprm);
|
||||
+extern int flush_old_exec(struct linux_binprm *bprm, bool unlink_thread);
|
||||
extern void setup_new_exec(struct linux_binprm * bprm);
|
||||
extern void would_dump(struct linux_binprm *, struct file *);
|
||||
|
||||
Index: linux-2.6.git/include/linux/elf_ckpt.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
|
Loading…
x
Reference in New Issue
Block a user