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: <Ym/ZoAIvawVUljjz@zn.tnic>
Date:   Mon, 2 May 2022 15:16:16 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
        Filipe Manana <fdmanana@...e.com>, stable@...r.kernel.org
Subject: Re: [patch 1/3] x86/fpu: Prevent FPU state corruption

On Sun, May 01, 2022 at 09:31:43PM +0200, Thomas Gleixner wrote:
> The latter is checking whether some other context already uses FPU in the
> kernel, but if that's not the case then it allows FPU to be used
> unconditionally even if the calling context interupted a fpregs_lock()

Unknown word [interupted] in commit message.
Suggestions: ['interrupted', ...

>  /*
>   * Can we use the FPU in kernel mode with the
>   * whole "kernel_fpu_begin/end()" sequence?

While at it, drop the "we": "Can the FPU be used in kernel mode... "

> - *
> - * It's always ok in process context (ie "not interrupt")
> - * but it is sometimes ok even from an irq.
>   */
>  bool irq_fpu_usable(void)
>  {
> -	return !in_interrupt() ||
> -		interrupted_user_mode() ||
> -		interrupted_kernel_fpu_idle();
> +	if (WARN_ON_ONCE(in_nmi()))
> +		return false;
> +
> +	/* In kernel FPU usage already active? */
> +	if (this_cpu_read(in_kernel_fpu))
> +		return false;
> +
> +	/*
> +	 * When not in NMI or hard interrupt context, FPU can be used:

"... can be used in:"

> +	 *
> +	 * - Task context is safe except from within fpregs_lock()'ed
> +	 *   critical regions.
> +	 *
> +	 * - Soft interrupt processing context which cannot happen
> +	 *   while in a fpregs_lock()'ed critical region.

But those are only nitpicks. With those fixed:

Reviewed-by: Borislav Petkov <bp@...e.de>

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ