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: <9bc8ec45-c87f-ad38-a028-0df50a0c4516@kernel.org>
Date:   Thu, 3 Jun 2021 10:36:19 -0700
From:   Andy Lutomirski <luto@...nel.org>
To:     Lai Jiangshan <jiangshanlai@...il.com>,
        linux-kernel@...r.kernel.org
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Lai Jiangshan <laijs@...ux.alibaba.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>
Subject: Re: [RFC PATCH 2/4] x86/entry/nmi: Use normal idtentry macro for NMI
 from userspace

On 5/31/21 11:52 PM, Lai Jiangshan wrote:
> From: Lai Jiangshan <laijs@...ux.alibaba.com>
> 
> Before tglx made huge refactor on entry code, high level code is called
> from ASM code including idtentry exit path which might reopen IRQ,
> reschedule, do signal among other works and made normal entry path not
> suitable for userspace NMI entry.  So when the commit 9b6e6a8334d56
> ("x86/nmi/64: Switch stacks on userspace NMI entry") added special code
> for userspace NMI entry, it didn't use normal entry code.
> 
> After the said refactor on entry code, high level code was moved into
> C code, and the idtentry macros are really low level and fit for
> userspace NMI entry after it switches to entry stack, so this
> patch uses idtentry_body macro for NMI from userspace.
> 
> Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
> ---
>  arch/x86/entry/entry_64.S | 42 ++++++---------------------------------
>  1 file changed, 6 insertions(+), 36 deletions(-)
> 
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 4190e668f346..f54e06139d4b 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -1113,11 +1113,7 @@ SYM_CODE_START(asm_exc_nmi)
>  	jz	.Lnmi_from_kernel
>  
>  	/*
> -	 * NMI from user mode.  We need to run on the thread stack, but we
> -	 * can't go through the normal entry paths: NMIs are masked, and
> -	 * we don't want to enable interrupts, because then we'll end
> -	 * up in an awkward situation in which IRQs are on but NMIs
> -	 * are off.
> +	 * NMI from user mode.  We need to run on the thread stack.

This comment is IMO still important, but I think you're right that it no
longer matters in the asm.  Could you relocate the comment to the
appropriate place in the C code so that a future cleanup doesn't mess up
the C path?

Thanks,
Andy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ