Skip to content

Commit e8b6f98

Browse files
suryasaimadhuKAGA-KOKO
authored andcommitted
x86/dumpstack: Add loglevel argument to show_opcodes()
Will be used in the next patch. Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Andy Lutomirski <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 9e4a90f commit e8b6f98

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

arch/x86/include/asm/stacktrace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,5 @@ static inline unsigned long caller_frame_pointer(void)
111111
return (unsigned long)frame;
112112
}
113113

114+
void show_opcodes(u8 *rip, const char *loglvl);
114115
#endif /* _ASM_X86_STACKTRACE_H */

arch/x86/kernel/dumpstack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ static void printk_stack_address(unsigned long address, int reliable,
7070
printk("%s %s%pB\n", log_lvl, reliable ? "" : "? ", (void *)address);
7171
}
7272

73-
static void show_opcodes(u8 *rip)
73+
void show_opcodes(u8 *rip, const char *loglvl)
7474
{
7575
unsigned int code_prologue = OPCODE_BUFSIZE * 2 / 3;
7676
u8 opcodes[OPCODE_BUFSIZE];
7777
u8 *ip;
7878
int i;
7979

80-
printk(KERN_DEFAULT "Code: ");
80+
printk("%sCode: ", loglvl);
8181

8282
ip = (u8 *)rip - code_prologue;
8383
if (probe_kernel_read(opcodes, ip, OPCODE_BUFSIZE)) {
@@ -401,6 +401,6 @@ void show_regs(struct pt_regs *regs)
401401
if (regs->ip < PAGE_OFFSET)
402402
printk(KERN_DEFAULT "Code: Bad RIP value.\n");
403403
else
404-
show_opcodes((u8 *)regs->ip);
404+
show_opcodes((u8 *)regs->ip, KERN_DEFAULT);
405405
}
406406
}

0 commit comments

Comments
 (0)