aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/dumpstack_32.c
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2016-10-25 10:51:13 -0400
committerIngo Molnar <mingo@kernel.org>2016-10-25 12:40:37 -0400
commit0ee1dd9f5e7eae4e55f95935b72d4beecb03de9c (patch)
treed552e8dc63d8daac8e472accff99b6710b57348e /arch/x86/kernel/dumpstack_32.c
parentbb5e5ce545f2031c96f7901cd8d1698ea3ca4c9c (diff)
x86/dumpstack: Remove raw stack dump
For mostly historical reasons, the x86 oops dump shows the raw stack values: ... [registers] Stack: ffff880079af7350 ffff880079905400 0000000000000000 ffffc900008f3ae0 ffffffffa0196610 0000000000000001 00010000ffffffff 0000000087654321 0000000000000002 0000000000000000 0000000000000000 0000000000000000 Call Trace: ... This seems to be an artifact from long ago, and probably isn't needed anymore. It generally just adds noise to the dump, and it can be actively harmful because it leaks kernel addresses. Linus says: "The stack dump actually goes back to forever, and it used to be useful back in 1992 or so. But it used to be useful mainly because stacks were simpler and we didn't have very good call traces anyway. I definitely remember having used them - I just do not remember having used them in the last ten+ years. Of course, it's still true that if you can trigger an oops, you've likely already lost the security game, but since the stack dump is so useless, let's aim to just remove it and make games like the above harder." This also removes the related 'kstack=' cmdline option and the 'kstack_depth_to_print' sysctl. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/e83bd50df52d8fe88e94d2566426ae40d813bf8f.1477405374.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/dumpstack_32.c')
-rw-r--r--arch/x86/kernel/dumpstack_32.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index 06eb322b5f9f..90cf460d50bd 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -121,36 +121,6 @@ unknown:
121 return -EINVAL; 121 return -EINVAL;
122} 122}
123 123
124void show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
125 unsigned long *sp, char *log_lvl)
126{
127 unsigned long *stack;
128 int i;
129
130 if (!try_get_task_stack(task))
131 return;
132
133 sp = sp ? : get_stack_pointer(task, regs);
134
135 stack = sp;
136 for (i = 0; i < kstack_depth_to_print; i++) {
137 if (kstack_end(stack))
138 break;
139 if ((i % STACKSLOTS_PER_LINE) == 0) {
140 if (i != 0)
141 pr_cont("\n");
142 printk("%s %08lx", log_lvl, *stack++);
143 } else
144 pr_cont(" %08lx", *stack++);
145 touch_nmi_watchdog();
146 }
147 pr_cont("\n");
148 show_trace_log_lvl(task, regs, sp, log_lvl);
149
150 put_task_stack(task);
151}
152
153
154void show_regs(struct pt_regs *regs) 124void show_regs(struct pt_regs *regs)
155{ 125{
156 int i; 126 int i;
@@ -168,8 +138,7 @@ void show_regs(struct pt_regs *regs)
168 unsigned char c; 138 unsigned char c;
169 u8 *ip; 139 u8 *ip;
170 140
171 pr_emerg("Stack:\n"); 141 show_trace_log_lvl(current, regs, NULL, KERN_EMERG);
172 show_stack_log_lvl(current, regs, NULL, KERN_EMERG);
173 142
174 pr_emerg("Code:"); 143 pr_emerg("Code:");
175 144