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]
Date:	Sat, 09 Feb 2013 20:34:53 -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: [PATCH 2/5 -v2.1] x86: Detect CPUID support early at boot

On 02/09/2013 03:16 PM, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.de>
>
> We detect CPUID function support on each CPU and save it for later use,
> obviating the need to play the toggle EFLAGS.ID game every time. C code
> is looking at ->cpuid_level anyway.
>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> ---
>   arch/x86/kernel/head_32.S | 48 +++++++++++++++++++++++------------------------
>   1 file changed, 23 insertions(+), 25 deletions(-)
>
> diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
> index f4d919e2cd2b..534397ba226c 100644
> --- a/arch/x86/kernel/head_32.S
> +++ b/arch/x86/kernel/head_32.S
> @@ -318,30 +318,37 @@ default_entry:
>   	movl %eax,%cr0
>
>   /*
> - *	New page tables may be in 4Mbyte page mode and may
> - *	be using the global pages.
> + * Initialize EFLAGS. Some BIOSes leave bits like NT set. This would confuse the
> + * debugger if this code is traced. Best to initialize before switching to
> + * protected mode. As a side effect, we clear DF too because GCC expects it so.
> + */
> +	pushl $0
> +	popfl
> +

I wouldn't really call it a "side effect".  Perhaps the right thing here 
is to say something like "we want to start out with %eflags 
unambiguously clear".

(Note also we have had to CLD earlier because we have already copied the 
command line.)

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.

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