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] [day] [month] [year] [list]
Message-ID: <511C207E.9030008@zytor.com>
Date:	Wed, 13 Feb 2013 15:23:42 -0800
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Borislav Petkov <bp@...en8.de>
CC:	X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
	Borislav Petkov <bp@...e.de>
Subject: Re: [RFC PATCH 1/4] x86, cpu: Expand cpufeature facility to include
 cpu bugs

On 02/11/2013 03:18 AM, Borislav Petkov wrote:
>  
> +#define __BUG_CHECK_BIT(bit)					\
> +({								\
> +	WARN_ON(bit >> 5 < NCAPINTS);				\
> +	bit;							\
> +})
> +

Do we need this?  Either way, if we do, I would suggest doing something
like:

	if (__builtin_constant_p(bit))
		bad_bug_number();

... and flag bad_bug_number as a compile time error, since the vast
majority of the time the bit number will be constant.

However, I don't think it is necessary.  In order for this to ever
trigger someone must have known they were testing for a bug, and yet not
used the X86_BUG_ macros, which seems very unlikely.

>  #define X86_BUG_F00F		(NCAPINTS*32+ 0) /* Intel F00F bug */
>  #define X86_BUG_FDIV		(NCAPINTS*32+ 1) /* FPU FDIV bug */
> +#define X86_BUG_COMA		(NCAPINTS*32+ 2) /* Cyrix 6x86 coma */

Just to make it a bit cleaner once we have more than one word of bug
tests, I would suggest macroizing this:

#define X86_BUG(x) (NCAPINTS*32 + (x))

... and then just ...

#define X86_BUG_F00F	X86_BUG(0)
#define X86_BUG_FDIV	X86_BUG(1)

... and so on.

The only reason we *don't* do that with the features is that they tend
to come chunkwise in the form of CPUID words.

	-hpa

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