A typedef user_ptr_perms_t is created of type cheri_perms_t in case of PCuABI. Otherwise, this defaults to int in non-PCuABI case. This will assist in using user_ptr_perms_t unconditionally.
Note: This change will make linux/cheri.h to get included everywhere as linux/kernel.h includes linux/user_ptr.h.
Signed-off-by: Amit Daniel Kachhap amitdaniel.kachhap@arm.com --- include/linux/user_ptr.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/linux/user_ptr.h b/include/linux/user_ptr.h index 685586bc0d89..0e40b9850bf3 100644 --- a/include/linux/user_ptr.h +++ b/include/linux/user_ptr.h @@ -2,6 +2,7 @@ #ifndef _LINUX_USER_PTR_H #define _LINUX_USER_PTR_H
+#include <linux/cheri.h> #include <linux/limits.h> #include <linux/typecheck.h>
@@ -27,6 +28,8 @@
#ifdef CONFIG_CHERI_PURECAP_UABI
+typedef cheri_perms_t user_ptr_perms_t; + /** * uaddr_to_user_ptr() - Convert a user-provided address to a user pointer. * @addr: The address to set the pointer to. @@ -109,6 +112,8 @@ bool check_user_ptr_rw(void __user *ptr, size_t len);
#else /* CONFIG_CHERI_PURECAP_UABI */
+typedef int user_ptr_perms_t; + static inline void __user *uaddr_to_user_ptr(ptraddr_t addr) { return as_user_ptr(addr);