Re: [PATCH v2 1/9] s390/uaccess: Add storage key checked cmpxchg access to user space

Heiko Carstens
2022-10-20T11:19:08Z

Hi Janis,

On Wed, Oct 12, 2022 at 10:56:01PM +0200, Janis Schoetterl-Glausch wrote:
> Add cmpxchg functionality similar to that in cmpxchg.h except that the
> target is a user space address and that the address' storage key is
> matched with the access_key argument in order to honor key-controlled
> protection.
> The access is performed by changing to the secondary-spaces mode and
> setting the PSW key for the duration of the compare and swap.
>
> Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
> ---
>
>
> Possible variations:
> * check the assumptions made in cmpxchg_user_key_size and error out
> * call functions called by copy_to_user
> * access_ok? is a nop
> * should_fail_usercopy?
> * instrument_copy_to_user? doesn't make sense IMO
> * don't be overly strict in cmpxchg_user_key
>
>
> arch/s390/include/asm/uaccess.h | 189 ++++++++++++++++++++++++++++++++
> 1 file changed, 189 insertions(+)

This not how I would have expected something that would be
symmetrical/consistent with what we already have. However instead of
spending several iterations I'll send something for this.

This might take a bit due to my limited time. So please be patient.