Commit 9d5b327b authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

coredump: make mm->core_state visible to ->core_dump()

Move the "struct core_state core_state" from coredump_wait() to
do_coredump(), this makes mm->core_state visible to binfmt->core_dump().
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Acked-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c5f1cc8c
...@@ -1595,17 +1595,16 @@ static inline int zap_threads(struct task_struct *tsk, struct mm_struct *mm, ...@@ -1595,17 +1595,16 @@ static inline int zap_threads(struct task_struct *tsk, struct mm_struct *mm,
return nr; return nr;
} }
static int coredump_wait(int exit_code) static int coredump_wait(int exit_code, struct core_state *core_state)
{ {
struct task_struct *tsk = current; struct task_struct *tsk = current;
struct mm_struct *mm = tsk->mm; struct mm_struct *mm = tsk->mm;
struct core_state core_state;
struct completion *vfork_done; struct completion *vfork_done;
int core_waiters; int core_waiters;
init_completion(&mm->core_done); init_completion(&mm->core_done);
init_completion(&core_state.startup); init_completion(&core_state->startup);
core_waiters = zap_threads(tsk, mm, &core_state, exit_code); core_waiters = zap_threads(tsk, mm, core_state, exit_code);
up_write(&mm->mmap_sem); up_write(&mm->mmap_sem);
if (unlikely(core_waiters < 0)) if (unlikely(core_waiters < 0))
...@@ -1622,8 +1621,7 @@ static int coredump_wait(int exit_code) ...@@ -1622,8 +1621,7 @@ static int coredump_wait(int exit_code)
} }
if (core_waiters) if (core_waiters)
wait_for_completion(&core_state.startup); wait_for_completion(&core_state->startup);
mm->core_state = NULL;
fail: fail:
return core_waiters; return core_waiters;
} }
...@@ -1679,6 +1677,7 @@ int get_dumpable(struct mm_struct *mm) ...@@ -1679,6 +1677,7 @@ int get_dumpable(struct mm_struct *mm)
int do_coredump(long signr, int exit_code, struct pt_regs * regs) int do_coredump(long signr, int exit_code, struct pt_regs * regs)
{ {
struct core_state core_state;
char corename[CORENAME_MAX_SIZE + 1]; char corename[CORENAME_MAX_SIZE + 1];
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
struct linux_binfmt * binfmt; struct linux_binfmt * binfmt;
...@@ -1717,7 +1716,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) ...@@ -1717,7 +1716,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
current->fsuid = 0; /* Dump root private */ current->fsuid = 0; /* Dump root private */
} }
retval = coredump_wait(exit_code); retval = coredump_wait(exit_code, &core_state);
if (retval < 0) if (retval < 0)
goto fail; goto fail;
...@@ -1812,6 +1811,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) ...@@ -1812,6 +1811,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
current->fsuid = fsuid; current->fsuid = fsuid;
complete_all(&mm->core_done); complete_all(&mm->core_done);
mm->core_state = NULL;
fail: fail:
return retval; return retval;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment