This change is made in preparation for the introduction of a purecap vDSO. While the vDSO is userspace shared library, it does use some kernel headers. Therefore, under purecap, any pointers in those headers must be compiled to capabilites.
Note that this does not make any part of the actual kernel purecap.
Signed-off-by: Aditya Deshpande aditya.deshpande@arm.com --- include/linux/compiler.h | 2 +- include/linux/types.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index d7779a18b24f..c2f87d9f3e1d 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -222,7 +222,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, */ static inline void *offset_to_ptr(const int *off) { - return (void *)((unsigned long)off + *off); + return (void *)((uintptr_t)off + *off); }
#endif /* __ASSEMBLY__ */ diff --git a/include/linux/types.h b/include/linux/types.h index 897c134c1e8a..5e7a6c948618 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -46,7 +46,11 @@ typedef __kernel_gid32_t gid_t; typedef __kernel_uid16_t uid16_t; typedef __kernel_gid16_t gid16_t;
+#ifdef __CHERI_PURE_CAPABILITY__ +typedef __uintcap_t uintptr_t; +#else typedef unsigned long uintptr_t; +#endif
#ifdef CONFIG_CHERI_PURECAP_UABI typedef __uintcap_t user_uintptr_t;