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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 6 Oct 2015 23:05:43 +0200 From: Rasmus Villemoes <linux@...musvillemoes.dk> To: Paul Gortmaker <paul.gortmaker@...driver.com>, Jiri Slaby <jslaby@...e.cz>, Ingo Molnar <mingo@...hat.com>, Andrew Morton <akpm@...ux-foundation.org>, Thomas Gleixner <tglx@...utronix.de>, "H. Peter Anvin" <hpa@...or.com>, Michal Marek <mmarek@...e.cz> Cc: Rasmus Villemoes <linux@...musvillemoes.dk>, linux-kernel@...r.kernel.org Subject: [PATCH 2/2] x86: dumpstack: eliminate some #ifdefs Jiri Slaby noted that these #ifdef protected printks should really be pr_cont. However, we might as well get completely rid of both the multiple printk calls and the tiny #ifdef sections by just building an appropriate string and passing that to the first printk call. Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk> --- Mostly an example of how 1/2 can be used. arch/x86/kernel/dumpstack.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 9c30acfadae2..6ae7e65e734e 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c @@ -257,21 +257,16 @@ int __die(const char *str, struct pt_regs *regs, long err) unsigned short ss; unsigned long sp; #endif + static const char build_flags[] = "" + CHOOSE_EXPR(CONFIG_PREEMPT, " PREEMPT") + CHOOSE_EXPR(CONFIG_SMP, " SMP") + CHOOSE_EXPR(CONFIG_DEBUG_PAGEALLOC, " DEBUG_PAGEALLOC") + CHOOSE_EXPR(CONFIG_KASAN, " KASAN"); + printk(KERN_DEFAULT - "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter); -#ifdef CONFIG_PREEMPT - printk("PREEMPT "); -#endif -#ifdef CONFIG_SMP - printk("SMP "); -#endif -#ifdef CONFIG_DEBUG_PAGEALLOC - printk("DEBUG_PAGEALLOC "); -#endif -#ifdef CONFIG_KASAN - printk("KASAN"); -#endif - printk("\n"); + "%s: %04lx [#%d]%s\n", str, err & 0xffff, ++die_counter, + build_flags); + if (notify_die(DIE_OOPS, str, regs, err, current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP) return 1; -- 2.1.3 -- 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