Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fc7f61c authored by Adrien Schildknecht's avatar Adrien Schildknecht Committed by Borislav Petkov
Browse files

x86/kernel: Fix output of show_stack_log_lvl()



show_stack_log_lvl() does not set the log level after a new line, the
following messages printed with pr_cont() are thus assigned to the
default log level.

This patch prepends the log level to the next message following a new
line.

print_trace_address() uses printk(log_lvl). Using printk() with just
a log level is ignored and thus has no effect on the next pr_cont().
We need to prepend the log level directly into the message.

Signed-off-by: default avatarAdrien Schildknecht <adrien+dev@schischi.me>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1424399661-20327-1-git-send-email-adrien+dev@schischi.me


Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
parent c517d838
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -25,10 +25,12 @@ unsigned int code_bytes = 64;
int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
static int die_counter;
static int die_counter;


static void printk_stack_address(unsigned long address, int reliable)
static void printk_stack_address(unsigned long address, int reliable,
		void *data)
{
{
	pr_cont(" [<%p>] %s%pB\n",
	printk("%s [<%p>] %s%pB\n",
		(void *)address, reliable ? "" : "? ", (void *)address);
		(char *)data, (void *)address, reliable ? "" : "? ",
		(void *)address);
}
}


void printk_address(unsigned long address)
void printk_address(unsigned long address)
@@ -155,8 +157,7 @@ static int print_trace_stack(void *data, char *name)
static void print_trace_address(void *data, unsigned long addr, int reliable)
static void print_trace_address(void *data, unsigned long addr, int reliable)
{
{
	touch_nmi_watchdog();
	touch_nmi_watchdog();
	printk(data);
	printk_stack_address(addr, reliable, data);
	printk_stack_address(addr, reliable);
}
}


static const struct stacktrace_ops print_trace_ops = {
static const struct stacktrace_ops print_trace_ops = {
+6 −3
Original line number Original line Diff line number Diff line
@@ -108,8 +108,11 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
	for (i = 0; i < kstack_depth_to_print; i++) {
	for (i = 0; i < kstack_depth_to_print; i++) {
		if (kstack_end(stack))
		if (kstack_end(stack))
			break;
			break;
		if (i && ((i % STACKSLOTS_PER_LINE) == 0))
		if ((i % STACKSLOTS_PER_LINE) == 0) {
			if (i != 0)
				pr_cont("\n");
				pr_cont("\n");
			printk("%s %08lx", log_lvl, *stack++);
		} else
			pr_cont(" %08lx", *stack++);
			pr_cont(" %08lx", *stack++);
		touch_nmi_watchdog();
		touch_nmi_watchdog();
	}
	}
+6 −3
Original line number Original line Diff line number Diff line
@@ -283,8 +283,11 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
		if (((long) stack & (THREAD_SIZE-1)) == 0)
		if (((long) stack & (THREAD_SIZE-1)) == 0)
			break;
			break;
		}
		}
		if (i && ((i % STACKSLOTS_PER_LINE) == 0))
		if ((i % STACKSLOTS_PER_LINE) == 0) {
			if (i != 0)
				pr_cont("\n");
				pr_cont("\n");
			printk("%s %016lx", log_lvl, *stack++);
		} else
			pr_cont(" %016lx", *stack++);
			pr_cont(" %016lx", *stack++);
		touch_nmi_watchdog();
		touch_nmi_watchdog();
	}
	}