All capabilities in hybrid (here compat64) should now be derived from cheri_user_root_all_cap. There is no helper to derive capabilities from this root, so do it manually. This is specific to PCuABI, but the generic implementation of compat_ptr() is appropriate in !PCuABI, so we can simply #ifdef the whole definition.
Also update the comment as this does not pertain to PCuABI as such.
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- arch/arm64/include/asm/compat.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 9c6112ae942b..1e4e8506a8b3 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -18,6 +18,7 @@ typedef u16 compat_mode_t; #include <linux/types.h> #include <linux/sched.h> #include <linux/sched/task_stack.h> +#include <linux/cheri.h>
#define COMPAT_USER_HZ 100 #ifdef __AARCH64EB__ @@ -104,15 +105,17 @@ struct compat_statfs {
#define COMPAT_OFF_T_MAX 0x7fffffff
+#ifdef CONFIG_CHERI_PURECAP_UABI static inline void __user *compat_ptr(compat_uptr_t uptr) { /* - * TODO [PCuABI] - this should be done using the current user DDC, not - * the root kernel one. + * TODO [Morello] - this should be done using the current user DDC, not + * the root user capability. */ - return uaddr_to_user_ptr_safe(uptr); + return (void __user *)cheri_address_set(cheri_user_root_all_cap, uptr); } #define compat_ptr(uptr) compat_ptr(uptr) +#endif
#define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current))) #define COMPAT_MINSIGSTKSZ 2048