[PATCH 3/7] arm64: uaccess: Add additional userspace GCS accessors
Mark Brown
broonie at kernel.org
Wed Mar 19 06:24:15 PDT 2025
On Tue, Mar 18, 2025 at 03:48:37PM -0500, Jeremy Linton wrote:
> +static inline u64 load_user_gcs(unsigned long __user *addr, int *err)
> +{
> + unsigned long ret;
> + u64 load;
> +
> + if (!access_ok((char __user *)addr, sizeof(load))) {
> + *err = -EFAULT;
> + return 0;
> + }
> +
> + gcsb_dsync();
> + ret = copy_from_user(&load, addr, sizeof(load));
> + if (ret != 0)
> + *err = ret;
> + return load;
> +}
A GCS load done by the hardware will verify that we are loading from GCS
memory (the accesses are marked as AccessType_GCS in the pseudocode
which is then validated in for example S1CheckPermissions()). Sadly
there's no equivalent of GCSSTR so we'd need to do the permission check
ourselves to match this behaviour.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250319/64d8a4b9/attachment.sig>
More information about the linux-arm-kernel
mailing list