On 17/01/2023 09:18, Kevin Brodsky wrote:
On 16/01/2023 17:45, 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).
COMPAT_MINISGSTKSZ is automatically defined to the native value in linux/compat.h if not defined, so only define it for COMPAT32 in arm64.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/include/asm/compat.h | 2 ++ include/asm-generic/compat.h | 10 ++++++++++
In general changes to arch and generic code should be in separate patches if possible, I think that's the case here.
Indeed, and that does make sense. I was wondering how to title a commit touching both generic and arch-specific, the answer appears to be don't do it :)
2 files changed, 12 insertions(+)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 2255df98fbcd..fe88e40f8960 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -96,7 +96,9 @@ 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_COMPAT32 #define COMPAT_MINSIGSTKSZ 2048 +#endif #ifdef CONFIG_COMPAT64 #define COMPAT_USE_64BIT_TIME 1 diff --git a/include/asm-generic/compat.h b/include/asm-generic/compat.h index 8aa32efdeee8..7bb8c04b2f8a 100644 --- a/include/asm-generic/compat.h +++ b/include/asm-generic/compat.h @@ -6,6 +6,15 @@ #define COMPAT_USER_HZ 100 #endif +#ifdef CONFIG_COMPAT64 +#ifndef COMPAT_RLIM_INFINITY
I think it would be a little more readable by nesting the #ifdef CONFIG_COMPAT64 inside each #ifndef COMPAT_* instead. Also make sure to add a comment after each #endif to help with the nesting.
Sure, that does sound better. Will update for v6.
Kevin
Thanks for the reviews !
Téo
+#define COMPAT_RLIM_INFINITY RLIM_INFINITY +#endif
+#ifndef COMPAT_OFF_T_MAX +#define COMPAT_OFF_T_MAX LONG_MAX +#endif +#else #ifndef COMPAT_RLIM_INFINITY #define COMPAT_RLIM_INFINITY 0xffffffff #endif @@ -13,6 +22,7 @@ #ifndef COMPAT_OFF_T_MAX #define COMPAT_OFF_T_MAX 0x7fffffff #endif +#endif #ifndef compat_arg_u64 #ifndef CONFIG_CPU_BIG_ENDIAN