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] [day] [month] [year] [list]
Message-ID: <9bc9896a-b0a3-41f4-9a51-dc0b0eb49f5c@efficios.com>
Date: Mon, 24 Feb 2025 14:11:08 -0500
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Dmitry Vyukov <dvyukov@...gle.com>, peterz@...radead.org,
 boqun.feng@...il.com, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
 dave.hansen@...ux.intel.com, hpa@...or.com, aruna.ramakrishna@...cle.com,
 elver@...gle.com
Cc: "Paul E. McKenney" <paulmck@...nel.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/4] x86/signal: Use write_permissive_pkey_val() helper

On 2025-02-24 08:20, Dmitry Vyukov wrote:
> Use the new switch_to_permissive_pkey_reg() helper instead of the
> custom code. No functional changes intended.
> 
> Signed-off-by: Dmitry Vyukov <dvyukov@...gle.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: "Paul E. McKenney" <paulmck@...nel.org>
> Cc: Boqun Feng <boqun.feng@...il.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Aruna Ramakrishna <aruna.ramakrishna@...cle.com>
> Cc: x86@...nel.org
> Cc: linux-kernel@...r.kernel.org
> 
> ---
> Changes in v3:
>   - restore sig_prepare_pkru with the large comment and
>     make it call the new write_permissive_pkey_val
> ---
>   arch/x86/kernel/signal.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
> index 5f441039b5725..27a66a0697dd2 100644
> --- a/arch/x86/kernel/signal.c
> +++ b/arch/x86/kernel/signal.c
> @@ -28,6 +28,7 @@
>   #include <linux/entry-common.h>
>   #include <linux/syscalls.h>
>   #include <linux/rseq.h>
> +#include <linux/pkeys.h>
>   
>   #include <asm/processor.h>
>   #include <asm/ucontext.h>
> @@ -72,10 +73,7 @@ static inline int is_x32_frame(struct ksignal *ksig)
>    */
>   static inline u32 sig_prepare_pkru(void)
>   {
> -	u32 orig_pkru = read_pkru();
> -
> -	write_pkru(0);
> -	return orig_pkru;
> +	return write_permissive_pkey_val();

Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>

Note that I would be curious to see if we could get away with changing
this to enable_zero_pkey_val() without breaking any real-life user.
AFAIU this would remove a WRPKRU from signal delivery, but would require
the signal frames to be pkey-0, which is technically be a new ABI
constraint never expressed before.

Thanks,

Mathieu


>   }
>   
>   /*


-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ