Skip to content

Commit 10970e1

Browse files
committed
x86/a.out: Clear the dump structure initially
dump_thread32() in aout_core_dump() does not clear the user32 structure allocated on the stack as the first thing on function entry. As a result, the dump.u_comm, dump.u_ar0 and dump.signal which get assigned before the clearing, get overwritten. Rename that function to fill_dump() to make it clear what it does and call it first thing. This was caught while staring at a patch by Derek Robson <robsonde@gmail.com>. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Derek Robson <robsonde@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Michael Matz <matz@suse.de> Cc: x86@kernel.org Cc: <stable@vger.kernel.org> Link: https://lkml.kernel.org/r/20190202005512.3144-1-robsonde@gmail.com
1 parent 20e55bc commit 10970e1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/ia32/ia32_aout.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static unsigned long get_dr(int n)
5151
/*
5252
* fill in the user structure for a core dump..
5353
*/
54-
static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
54+
static void fill_dump(struct pt_regs *regs, struct user32 *dump)
5555
{
5656
u32 fs, gs;
5757
memset(dump, 0, sizeof(*dump));
@@ -157,10 +157,12 @@ static int aout_core_dump(struct coredump_params *cprm)
157157
fs = get_fs();
158158
set_fs(KERNEL_DS);
159159
has_dumped = 1;
160+
161+
fill_dump(cprm->regs, &dump);
162+
160163
strncpy(dump.u_comm, current->comm, sizeof(current->comm));
161164
dump.u_ar0 = offsetof(struct user32, regs);
162165
dump.signal = cprm->siginfo->si_signo;
163-
dump_thread32(cprm->regs, &dump);
164166

165167
/*
166168
* If the size of the dump file exceeds the rlimit, then see

0 commit comments

Comments
 (0)