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: <20140130090902.GA2749@gmail.com>
Date:	Thu, 30 Jan 2014 10:09:02 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	hpa@...or.com, linux-kernel@...r.kernel.org, dwmw2@...radead.org,
	keescook@...omium.org, tglx@...utronix.de, hpa@...ux.intel.com,
	David.Woodhouse@...el.com
Cc:	linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/build] x86, boot: Fix word-size assumptions in
 has_eflag () inline asm


* tip-bot for David Woodhouse <tipbot@...or.com> wrote:

> Commit-ID:  9b3614ccfa5492f57f743f3856253f285b10a702
> Gitweb:     http://git.kernel.org/tip/9b3614ccfa5492f57f743f3856253f285b10a702
> Author:     David Woodhouse <dwmw2@...radead.org>
> AuthorDate: Wed, 29 Jan 2014 12:01:37 +0000
> Committer:  H. Peter Anvin <hpa@...ux.intel.com>
> CommitDate: Wed, 29 Jan 2014 09:09:40 -0800
> 
> x86, boot: Fix word-size assumptions in has_eflag() inline asm
> 
> Commit dd78b97367bd575918204cc89107c1479d3fc1a7 ("x86, boot: Move CPU
> flags out of cpucheck") introduced ambiguous inline asm in the
> has_eflag() function. We want the instruction to be 'pushfl', but we
> just say 'pushf' and hope the compiler does what we wanted.
> 
> When building with 'clang -m16', it won't, because clang doesn't use
> the horrid '.code16gcc' hack that even 'gcc -m16' uses internally.
> 
> Say what we mean and don't make the compiler make assumptions.
> 
> [ hpa: we use plain "pushf" in the equivalent code elsewhere which may
>   be compiled as either 32- or 64-bit code.  In those cases we want
>   the assembler to pick the appropriate size for us.  However, this is
>   *16-bit* code and we still need these to be 32-bit operations. ]
> 
> Signed-off-by: David Woodhouse <David.Woodhouse@...el.com>
> Link: http://lkml.kernel.org/r/1390996897.20153.123.camel@i7.infradead.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
> Signed-off-by: H. Peter Anvin <hpa@...ux.intel.com>
> ---
>  arch/x86/boot/cpuflags.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/boot/cpuflags.c b/arch/x86/boot/cpuflags.c
> index a9fcb7c..168dd25 100644
> --- a/arch/x86/boot/cpuflags.c
> +++ b/arch/x86/boot/cpuflags.c
> @@ -32,16 +32,16 @@ int has_eflag(unsigned long mask)
>  {
>  	unsigned long f0, f1;
>  
> -	asm volatile("pushf	\n\t"
> -		     "pushf	\n\t"
> +	asm volatile("pushfl	\n\t"
> +		     "pushfl	\n\t"
>  		     "pop %0	\n\t"
>  		     "mov %0,%1	\n\t"
>  		     "xor %2,%1	\n\t"
>  		     "push %1	\n\t"
> -		     "popf	\n\t"
> -		     "pushf	\n\t"
> +		     "popfl	\n\t"
> +		     "pushfl	\n\t"
>  		     "pop %1	\n\t"
> -		     "popf"
> +		     "popfl"
>  		     : "=&r" (f0), "=&r" (f1)
>  		     : "ri" (mask));

This broke the build though:

arch/x86/boot/compressed/../cpuflags.c: Assembler messages:
arch/x86/boot/compressed/../cpuflags.c:35: Error: invalid instruction suffix for `pushf'

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