x86/process: Don't mix user/kernel regs in 64bit __show_regs()
When the kernel.print-fatal-signals sysctl has been enabled, a simple
userspace crash will cause the kernel to write a crash dump that contains,
among other things, the kernel gsbase into dmesg.
As suggested by Andy, limit output to pt_regs, FS_BASE and KERNEL_GS_BASE
in this case.
This also moves the bitness-specific logic from show_regs() into
process_{32,64}.c.
Fixes: 45807a1df9
("vdso: print fatal signals")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20180831194151.123586-1-jannh@google.com
This commit is contained in:

committed by
Thomas Gleixner

parent
17f6bac224
commit
9fe6299dde
@@ -146,7 +146,7 @@ static void show_regs_if_on_stack(struct stack_info *info, struct pt_regs *regs,
|
||||
* they can be printed in the right context.
|
||||
*/
|
||||
if (!partial && on_stack(info, regs, sizeof(*regs))) {
|
||||
__show_regs(regs, 0);
|
||||
__show_regs(regs, SHOW_REGS_SHORT);
|
||||
|
||||
} else if (partial && on_stack(info, (void *)regs + IRET_FRAME_OFFSET,
|
||||
IRET_FRAME_SIZE)) {
|
||||
@@ -344,7 +344,7 @@ void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
|
||||
oops_exit();
|
||||
|
||||
/* Executive summary in case the oops scrolled away */
|
||||
__show_regs(&exec_summary_regs, true);
|
||||
__show_regs(&exec_summary_regs, SHOW_REGS_ALL);
|
||||
|
||||
if (!signr)
|
||||
return;
|
||||
@@ -407,14 +407,9 @@ void die(const char *str, struct pt_regs *regs, long err)
|
||||
|
||||
void show_regs(struct pt_regs *regs)
|
||||
{
|
||||
bool all = true;
|
||||
|
||||
show_regs_print_info(KERN_DEFAULT);
|
||||
|
||||
if (IS_ENABLED(CONFIG_X86_32))
|
||||
all = !user_mode(regs);
|
||||
|
||||
__show_regs(regs, all);
|
||||
__show_regs(regs, user_mode(regs) ? SHOW_REGS_USER : SHOW_REGS_ALL);
|
||||
|
||||
/*
|
||||
* When in-kernel, we also print out the stack at the time of the fault..
|
||||
|
Reference in New Issue
Block a user