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: <32af68b8-4280-4c15-8e5c-be807c282f94@intel.com>
Date: Fri, 21 Feb 2025 09:01:03 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Dmitry Vyukov <dvyukov@...gle.com>, mathieu.desnoyers@...icios.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 1/4] pkeys: add API to switch to permissive pkey register

On 2/17/25 03:07, Dmitry Vyukov wrote:
...
>  /*
>   * If more than 16 keys are ever supported, a thorough audit
>   * will be necessary to ensure that the types that store key
> @@ -123,4 +125,16 @@ static inline int vma_pkey(struct vm_area_struct *vma)
>  	return (vma->vm_flags & vma_pkey_mask) >> VM_PKEY_SHIFT;
>  }
>  
> +typedef u32 pkey_reg_t;
> +
> +static inline pkey_reg_t switch_to_permissive_pkey_reg(void)
> +{
> +	return write_pkru(0);
> +}

Just a naming nit: the "switch_to" and "reg" parts of this don't quite
parse for me. This is writing a _value_ to a register. Maybe:

	write_permissive_pkey_val()
or
	set_permissive_pkey_val()

would be a better name.

> diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h
> index 86be8bf27b41b..d94a0ae7a784b 100644
> --- a/include/linux/pkeys.h
> +++ b/include/linux/pkeys.h
> @@ -48,4 +48,26 @@ static inline bool arch_pkeys_enabled(void)
>  
>  #endif /* ! CONFIG_ARCH_HAS_PKEYS */
>  
> +#ifndef CONFIG_ARCH_HAS_PERMISSIVE_PKEY
> +
> +/*
> + * Common name for value of the register that controls access to PKEYs
> + * (called differently on different arches: PKRU, POR, AMR).
> + */
> +typedef int pkey_reg_t;
Tiny nit: Should this be an unsigned type?

Nobody should be manipulating it, but I'd be surprised if any of the
architectures have a signed type for it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ