This rebases the patch on kernel 6.1 and slightly reworks it. Indeed, it removes some defines that are now consolidated in the generic compat header, and now takes advantage that COMPAT_MINSIGSTKSZ is defined in linux/compat.h if it is not already.
Teo Couprie Diaz (2): arm64: compat: Remove defines now in asm-generic compat: update compat defines to 64-bits
arch/arm64/include/asm/compat.h | 6 ++---- include/asm-generic/compat.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-)
Some generic COMPAT definitions have been consolidated in asm-generic/compat.h. Remove those that are already defined there from arm64 asm/compat.h.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com --- arch/arm64/include/asm/compat.h | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index a85a500148ac..2255df98fbcd 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -85,10 +85,6 @@ struct compat_statfs { compat_long_t f_spare[4]; };
-#define COMPAT_RLIM_INFINITY 0xffffffff - -#define COMPAT_OFF_T_MAX 0x7fffffff - static inline void __user *compat_ptr(compat_uptr_t uptr) { /*
On 16/01/2023 17:45, Teo Couprie Diaz wrote:
Some generic COMPAT definitions have been consolidated in asm-generic/compat.h.
It's worth referring to the commit that did that, here commit 84a0c977ab98 ("asm-generic: compat: Cleanup duplicate definitions").
Remove those that are already defined there
... to the same value.
Kevin
from arm64 asm/compat.h.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/include/asm/compat.h | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index a85a500148ac..2255df98fbcd 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -85,10 +85,6 @@ struct compat_statfs { compat_long_t f_spare[4]; }; -#define COMPAT_RLIM_INFINITY 0xffffffff
-#define COMPAT_OFF_T_MAX 0x7fffffff
static inline void __user *compat_ptr(compat_uptr_t uptr) { /*
On 17/01/2023 09:18, Kevin Brodsky wrote:
On 16/01/2023 17:45, Teo Couprie Diaz wrote:
Some generic COMPAT definitions have been consolidated in asm-generic/compat.h.
It's worth referring to the commit that did that, here commit 84a0c977ab98 ("asm-generic: compat: Cleanup duplicate definitions").
Of course, I even had the hash copied but forgot to add it !
Remove those that are already defined there
... to the same value.
Sounds good
Kevin
from arm64 asm/compat.h.
Signed-off-by: Teo Couprie Diaz teo.coupriediaz@arm.com
arch/arm64/include/asm/compat.h | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index a85a500148ac..2255df98fbcd 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -85,10 +85,6 @@ struct compat_statfs { compat_long_t f_spare[4]; }; -#define COMPAT_RLIM_INFINITY 0xffffffff
-#define COMPAT_OFF_T_MAX 0x7fffffff
- static inline void __user *compat_ptr(compat_uptr_t uptr) { /*
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 ++++++++++ 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 +#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
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.
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.
Kevin
+#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
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
linux-morello@op-lists.linaro.org