Skip to content

Commit

Permalink
coredump: make mm->core_state visible to ->core_dump()
Browse files Browse the repository at this point in the history
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: Oleg Nesterov <[email protected]>
Acked-by: Roland McGrath <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Oleg Nesterov authored and torvalds committed Jul 25, 2008
1 parent c5f1cc8 commit 9d5b327
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1595,17 +1595,16 @@ static inline int zap_threads(struct task_struct *tsk, struct mm_struct *mm,
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 mm_struct *mm = tsk->mm;
struct core_state core_state;
struct completion *vfork_done;
int core_waiters;

init_completion(&mm->core_done);
init_completion(&core_state.startup);
core_waiters = zap_threads(tsk, mm, &core_state, exit_code);
init_completion(&core_state->startup);
core_waiters = zap_threads(tsk, mm, core_state, exit_code);
up_write(&mm->mmap_sem);

if (unlikely(core_waiters < 0))
Expand All @@ -1622,8 +1621,7 @@ static int coredump_wait(int exit_code)
}

if (core_waiters)
wait_for_completion(&core_state.startup);
mm->core_state = NULL;
wait_for_completion(&core_state->startup);
fail:
return core_waiters;
}
Expand Down Expand Up @@ -1679,6 +1677,7 @@ int get_dumpable(struct mm_struct *mm)

int do_coredump(long signr, int exit_code, struct pt_regs * regs)
{
struct core_state core_state;
char corename[CORENAME_MAX_SIZE + 1];
struct mm_struct *mm = current->mm;
struct linux_binfmt * binfmt;
Expand Down Expand Up @@ -1717,7 +1716,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
current->fsuid = 0; /* Dump root private */
}

retval = coredump_wait(exit_code);
retval = coredump_wait(exit_code, &core_state);
if (retval < 0)
goto fail;

Expand Down Expand Up @@ -1812,6 +1811,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)

current->fsuid = fsuid;
complete_all(&mm->core_done);
mm->core_state = NULL;
fail:
return retval;
}

0 comments on commit 9d5b327

Please sign in to comment.