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: <20151007070321.GB7837@gmail.com>
Date:	Wed, 7 Oct 2015 09:03:21 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:	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>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] x86: dumpstack: eliminate some #ifdefs


* Rasmus Villemoes <linux@...musvillemoes.dk> wrote:

> +	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;

Looks cleaner than what we had before, but I have a naming nit: CHOOSE_EXPR() is 
not something I'd be able to remember, I'd have to look it up again all the time, 
because it does not have 'config' in its name, and because 'choose' is usually 
associated with different constructs.

So how about something more intuitive, like:

		COND_CONFIG(CONFIG_PREEMPT,		" PREEMPT")
		COND_CONFIG(CONFIG_SMP,			" SMP")
		COND_CONFIG(CONFIG_DEBUG_PAGEALLOC,	" DEBUG_PAGEALLOC")
		COND_CONFIG(CONFIG_KASAN,		" KASAN");

or:

		IF_CONFIG(CONFIG_PREEMPT,		" PREEMPT")
		IF_CONFIG(CONFIG_SMP,			" SMP")
		IF_CONFIG(CONFIG_DEBUG_PAGEALLOC,	" DEBUG_PAGEALLOC")
		IF_CONFIG(CONFIG_KASAN,			" KASAN");

?

Both names are still unused in the kernel repo.

Thanks,

	Ingo
--
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