Some compat defines are still using 32-bits values, update them to a 64-bits one (COMPAT_OFF_T_MAX) or use the native value in COMPAT64 (COMPAT_RLIM_INFINITY, COMPAT_MINSIGSTKSZ).
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com --- arch/arm64/include/asm/compat.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 9c6112ae942b..85b6972745de 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -15,6 +15,7 @@ typedef u16 compat_mode_t; /* * Architecture specific compatibility types */ +#include <linux/resource.h> #include <linux/types.h> #include <linux/sched.h> #include <linux/sched/task_stack.h> @@ -100,9 +101,15 @@ struct compat_statfs { compat_long_t f_spare[4]; };
+#ifdef CONFIG_COMPAT64 +#define COMPAT_RLIM_INFINITY RLIM_INFINITY + +#define COMPAT_OFF_T_MAX 0x7fffffffffffffff +#else #define COMPAT_RLIM_INFINITY 0xffffffff
#define COMPAT_OFF_T_MAX 0x7fffffff +#endif
static inline void __user *compat_ptr(compat_uptr_t uptr) { @@ -115,7 +122,12 @@ static inline void __user *compat_ptr(compat_uptr_t uptr) #define compat_ptr(uptr) compat_ptr(uptr)
#define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current))) + +#ifdef CONFIG_COMPAT64 +#define COMPAT_MINSIGSTKSZ MINSIGSTKSZ +#else #define COMPAT_MINSIGSTKSZ 2048 +#endif
#ifdef CONFIG_COMPAT64 #define COMPAT_USE_64BIT_TIME 1
Sorry didn't notice in v1: "asm" is not normally used in commit title tags. For this file "arm64: compat:" is the most common.
On 22/12/2022 14:49, Teo Couprie Diaz wrote:
Some compat defines are still using 32-bits values, update them to a 64-bits one (COMPAT_OFF_T_MAX) or use the native value in COMPAT64 (COMPAT_RLIM_INFINITY, COMPAT_MINSIGSTKSZ).
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/include/asm/compat.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 9c6112ae942b..85b6972745de 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -15,6 +15,7 @@ typedef u16 compat_mode_t; /*
- Architecture specific compatibility types
*/ +#include <linux/resource.h> #include <linux/types.h> #include <linux/sched.h> #include <linux/sched/task_stack.h> @@ -100,9 +101,15 @@ struct compat_statfs { compat_long_t f_spare[4]; }; +#ifdef CONFIG_COMPAT64 +#define COMPAT_RLIM_INFINITY RLIM_INFINITY
+#define COMPAT_OFF_T_MAX 0x7fffffffffffffff
I think you could use LONG_MAX instead. If we had something like COMPAT_LONG_MAX we could avoid the #ifdef altogether, but we don't and adding COMPAT_*_{MIN,MAX} is probably not worth the effort.
+#else #define COMPAT_RLIM_INFINITY 0xffffffff #define COMPAT_OFF_T_MAX 0x7fffffff +#endif static inline void __user *compat_ptr(compat_uptr_t uptr) { @@ -115,7 +122,12 @@ static inline void __user *compat_ptr(compat_uptr_t uptr) #define compat_ptr(uptr) compat_ptr(uptr) #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
+#ifdef CONFIG_COMPAT64 +#define COMPAT_MINSIGSTKSZ MINSIGSTKSZ
Might be good to include <asm/compat.h> just to make sure it's defined, even if it happens to build fine right now.
Kevin
+#else #define COMPAT_MINSIGSTKSZ 2048 +#endif #ifdef CONFIG_COMPAT64 #define COMPAT_USE_64BIT_TIME 1
On 27/12/2022 16:02, Kevin Brodsky wrote:
Sorry didn't notice in v1: "asm" is not normally used in commit title tags. For this file "arm64: compat:" is the most common.
No worries ! I wasn't sure so thanks for clarifying.
On 22/12/2022 14:49, Teo Couprie Diaz wrote:
Some compat defines are still using 32-bits values, update them to a 64-bits one (COMPAT_OFF_T_MAX) or use the native value in COMPAT64 (COMPAT_RLIM_INFINITY, COMPAT_MINSIGSTKSZ).
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/include/asm/compat.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 9c6112ae942b..85b6972745de 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -15,6 +15,7 @@ typedef u16 compat_mode_t; /*
- Architecture specific compatibility types
*/ +#include <linux/resource.h> #include <linux/types.h> #include <linux/sched.h> #include <linux/sched/task_stack.h> @@ -100,9 +101,15 @@ struct compat_statfs { compat_long_t f_spare[4]; }; +#ifdef CONFIG_COMPAT64 +#define COMPAT_RLIM_INFINITY RLIM_INFINITY
+#define COMPAT_OFF_T_MAX 0x7fffffffffffffff
I think you could use LONG_MAX instead. If we had something like COMPAT_LONG_MAX we could avoid the #ifdef altogether, but we don't and adding COMPAT_*_{MIN,MAX} is probably not worth the effort.
Good point, I didn't think of it ! Updated in v3. It would have been nice having compat integer limits, but quite an effort indeed.
+#else #define COMPAT_RLIM_INFINITY 0xffffffff #define COMPAT_OFF_T_MAX 0x7fffffff +#endif static inline void __user *compat_ptr(compat_uptr_t uptr) { @@ -115,7 +122,12 @@ static inline void __user *compat_ptr(compat_uptr_t uptr) #define compat_ptr(uptr) compat_ptr(uptr) #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
+#ifdef CONFIG_COMPAT64 +#define COMPAT_MINSIGSTKSZ MINSIGSTKSZ
Might be good to include <asm/compat.h> just to make sure it's defined, even if it happens to build fine right now.
Agreed, so much so that I thought I already included it. No issues when compiling with it, so added.
Kevin
Thanks for the review, Téo
+#else #define COMPAT_MINSIGSTKSZ 2048 +#endif #ifdef CONFIG_COMPAT64 #define COMPAT_USE_64BIT_TIME 1
linux-morello@op-lists.linaro.org