diff options
| author | Borislav Petkov <bp@suse.de> | 2018-04-17 12:11:20 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2018-04-26 10:15:26 -0400 |
| commit | e8b6f984516b1fcb0ccf4469ca42777c9c2dc76d (patch) | |
| tree | 019197135ce911080bc2ac8ef5897855b24ca544 | |
| parent | 9e4a90fd34445df64a13d136676a31a4dd22aea3 (diff) | |
x86/dumpstack: Add loglevel argument to show_opcodes()
Will be used in the next patch.
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Link: https://lkml.kernel.org/r/20180417161124.5294-6-bp@alien8.de
| -rw-r--r-- | arch/x86/include/asm/stacktrace.h | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/dumpstack.c | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h index 133d9425fced..0630eeb18bbc 100644 --- a/arch/x86/include/asm/stacktrace.h +++ b/arch/x86/include/asm/stacktrace.h | |||
| @@ -111,4 +111,5 @@ static inline unsigned long caller_frame_pointer(void) | |||
| 111 | return (unsigned long)frame; | 111 | return (unsigned long)frame; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | void show_opcodes(u8 *rip, const char *loglvl); | ||
| 114 | #endif /* _ASM_X86_STACKTRACE_H */ | 115 | #endif /* _ASM_X86_STACKTRACE_H */ |
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 1d6698b54527..1592d0c3ebb5 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c | |||
| @@ -70,14 +70,14 @@ static void printk_stack_address(unsigned long address, int reliable, | |||
| 70 | printk("%s %s%pB\n", log_lvl, reliable ? "" : "? ", (void *)address); | 70 | printk("%s %s%pB\n", log_lvl, reliable ? "" : "? ", (void *)address); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | static void show_opcodes(u8 *rip) | 73 | void show_opcodes(u8 *rip, const char *loglvl) |
| 74 | { | 74 | { |
| 75 | unsigned int code_prologue = OPCODE_BUFSIZE * 2 / 3; | 75 | unsigned int code_prologue = OPCODE_BUFSIZE * 2 / 3; |
| 76 | u8 opcodes[OPCODE_BUFSIZE]; | 76 | u8 opcodes[OPCODE_BUFSIZE]; |
| 77 | u8 *ip; | 77 | u8 *ip; |
| 78 | int i; | 78 | int i; |
| 79 | 79 | ||
| 80 | printk(KERN_DEFAULT "Code: "); | 80 | printk("%sCode: ", loglvl); |
| 81 | 81 | ||
| 82 | ip = (u8 *)rip - code_prologue; | 82 | ip = (u8 *)rip - code_prologue; |
| 83 | if (probe_kernel_read(opcodes, ip, OPCODE_BUFSIZE)) { | 83 | if (probe_kernel_read(opcodes, ip, OPCODE_BUFSIZE)) { |
| @@ -401,6 +401,6 @@ void show_regs(struct pt_regs *regs) | |||
| 401 | if (regs->ip < PAGE_OFFSET) | 401 | if (regs->ip < PAGE_OFFSET) |
| 402 | printk(KERN_DEFAULT "Code: Bad RIP value.\n"); | 402 | printk(KERN_DEFAULT "Code: Bad RIP value.\n"); |
| 403 | else | 403 | else |
| 404 | show_opcodes((u8 *)regs->ip); | 404 | show_opcodes((u8 *)regs->ip, KERN_DEFAULT); |
| 405 | } | 405 | } |
| 406 | } | 406 | } |
