lkml.org 
[lkml]   [2023]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH v7 09/39] arm64/gcs: Provide put_user_gcs()
    In order for EL1 to write to an EL0 GCS it must use the GCSSTTR instruction
    rather than a normal STTR. Provide a put_user_gcs() which does this.

    Signed-off-by: Mark Brown <broonie@kernel.org>
    ---
    arch/arm64/include/asm/uaccess.h | 18 ++++++++++++++++++
    1 file changed, 18 insertions(+)

    diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
    index 22e10e79f56a..e118c3d772c8 100644
    --- a/arch/arm64/include/asm/uaccess.h
    +++ b/arch/arm64/include/asm/uaccess.h
    @@ -445,6 +445,24 @@ static inline int gcssttr(unsigned long __user *addr, unsigned long val)
    return err;
    }

    +static inline void put_user_gcs(unsigned long val, unsigned long __user *addr,
    + int *err)
    +{
    + int ret;
    +
    + if (!access_ok((char __user *)addr, sizeof(u64))) {
    + *err = -EFAULT;
    + return;
    + }
    +
    + uaccess_ttbr0_enable();
    + ret = gcssttr(addr, val);
    + if (ret != 0)
    + *err = ret;
    + uaccess_ttbr0_disable();
    +}
    +
    +
    #endif /* CONFIG_ARM64_GCS */

    #endif /* __ASM_UACCESS_H */
    --
    2.39.2

    \
     
     \ /
      Last update: 2023-11-22 10:44    [W:5.070 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site