lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1254904787-11323-7-git-send-email-alan-jenkins@tuffmail.co.uk>
Date:	Wed,  7 Oct 2009 09:39:46 +0100
From:	Alan Jenkins <alan-jenkins@...fmail.co.uk>
To:	mingo@...hat.com
Cc:	x86@...nel.org, linux-kernel@...r.kernel.org,
	torvalds@...ux-foundation.org,
	Alan Jenkins <alan-jenkins@...fmail.co.uk>
Subject: [PATCH 6/7] x86 dumpstack: fix printing of stack dump loglevels

Commit 5fd29d6 "printk: clean up handling of log-levels and newlines"
breaks the log level in the output of the x86 stack dumper:

    Pid: 2199, comm: klauncher Not tainted (2.6.32-rc2eeepc-test #483) 701
     EFLAGS: 00010296 CPU: 0
     EIP is at fget_light+0x39/0x79
     ...
     Stack:
     00000020 dbe23e7c dbe23f8c c01a62bd 00000001 d759c400 dbc61840 00000000
     <0> 08088728 08088750 00000000 dbe23e74 dbe23ea4 00000000 00000000 00000000
     <0> dbe23c18 00c7afc0 c01a6eb1 ffffffff 00000000 dbc61840 00000000 00000000

      ^ stray loglevel tokens

Those last two lines will also be incorrectly output as KERN_DEFAULT.

In this case the problem is effectively

    printk("\n" KERN_EMERG);

Changing printk() to accept loglevels in the middle of the string again
would be non-trivial.  Let's accept this limitation and simply split the
above code into two separate calls to printk().

Signed-off-by: Alan Jenkins <alan-jenkins@...fmail.co.uk>
---
 arch/x86/kernel/dumpstack_32.c |    6 ++++--
 arch/x86/kernel/dumpstack_64.c |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index f7dd2a7..8f1fb21 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -88,8 +88,10 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
 	for (i = 0; i < kstack_depth_to_print; i++) {
 		if (kstack_end(stack))
 			break;
-		if (i && ((i % STACKSLOTS_PER_LINE) == 0))
-			printk("\n%s", log_lvl);
+		if (i && ((i % STACKSLOTS_PER_LINE) == 0)) {
+			printk("\n");
+			printk("%s", log_lvl);
+		}
 		printk(" %08lx", *stack++);
 		touch_nmi_watchdog();
 	}
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index a071e6b..dbe1734 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -235,8 +235,10 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
 		if (((long) stack & (THREAD_SIZE-1)) == 0)
 			break;
 		}
-		if (i && ((i % STACKSLOTS_PER_LINE) == 0))
-			printk("\n%s", log_lvl);
+		if (i && ((i % STACKSLOTS_PER_LINE) == 0)) {
+			printk("\n");
+			printk("%s", log_lvl);
+		}
 		printk(" %016lx", *stack++);
 		touch_nmi_watchdog();
 	}
-- 
1.6.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ