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: <d2b0c6a5-19d8-f868-e092-e5c197ab0d0e@citrix.com>
Date:   Mon, 24 Aug 2020 15:22:06 +0100
From:   Andrew Cooper <andrew.cooper3@...rix.com>
To:     <peterz@...radead.org>, <x86@...nel.org>
CC:     Juergen Gross <jgross@...e.com>,
        LKML <linux-kernel@...r.kernel.org>,
        "Andy Lutomirski" <luto@...nel.org>
Subject: Re: [PATCH] x86/entry: Fix AC assertion

On 24/08/2020 11:14, peterz@...radead.org wrote:
> The WARN added in commit 3c73b81a9164 ("x86/entry, selftests: Further
> improve user entry sanity checks") unconditionally triggers on my IVB
> machine because it does not support SMAP.
>
> For !SMAP hardware we patch out CLAC/STAC instructions and thus if
> userspace sets AC, we'll still have it set after entry.

Technically, you don't patch in, rather than patch out.

>
> Fixes: 3c73b81a9164 ("x86/entry, selftests: Further improve user entry sanity checks")
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Acked-by: Andy Lutomirski <luto@...nel.org>
> ---
>  arch/x86/include/asm/entry-common.h |   11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> --- a/arch/x86/include/asm/entry-common.h
> +++ b/arch/x86/include/asm/entry-common.h
> @@ -18,8 +18,15 @@ static __always_inline void arch_check_u
>  		 * state, not the interrupt state as imagined by Xen.
>  		 */
>  		unsigned long flags = native_save_fl();
> -		WARN_ON_ONCE(flags & (X86_EFLAGS_AC | X86_EFLAGS_DF |
> -				      X86_EFLAGS_NT));
> +		unsigned long mask = X86_EFLAGS_DF | X86_EFLAGS_NT;
> +
> +		/*
> +		 * For !SMAP hardware we patch out CLAC on entry.
> +		 */
> +		if (boot_cpu_has(X86_FEATURE_SMAP))
> +			mask |= X86_EFLAGS_AC;

The Xen PV ABI clears AC on entry for 64bit guests, because Linux is
actually running in Ring 3, and therefore susceptible to #AC's which
wouldn't occur natively.

~Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ