To fix kabi change caused by commit 1c33bb050750 ("x86/elf: Support a new ELF aux vector AT_MINSIGSTKSZ"), add the same size padding to the original position of saved_auxv, then move saved_auxv[] with the new size to the end of mm_struct, and use the __GENKSYMS__ macro to avoid kabi change.
All the modifications are applied to x86_64 only.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/x86/include/uapi/asm/auxvec.h | 1 + include/linux/mm_types.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/arch/x86/include/uapi/asm/auxvec.h b/arch/x86/include/uapi/asm/auxvec.h index 6beb55bbefa4..bc116e7dc143 100644 --- a/arch/x86/include/uapi/asm/auxvec.h +++ b/arch/x86/include/uapi/asm/auxvec.h @@ -12,6 +12,7 @@
/* entries in ARCH_DLINFO: */ #if defined(CONFIG_IA32_EMULATION) || !defined(CONFIG_X86_64) +# define AT_VECTOR_SIZE_ARCH_OLD 2 # define AT_VECTOR_SIZE_ARCH 3 #else /* else it's non-compat x86-64 */ # define AT_VECTOR_SIZE_ARCH 2 diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 1c22e294f083..71df1586e36f 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -22,6 +22,11 @@ #ifndef AT_VECTOR_SIZE_ARCH #define AT_VECTOR_SIZE_ARCH 0 #endif + +#ifdef CONFIG_X86_64 +#define AT_VECTOR_SIZE_OLD (2*(AT_VECTOR_SIZE_ARCH_OLD + AT_VECTOR_SIZE_BASE + 1)) +#endif + #define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
#define INIT_PASID 0 @@ -508,7 +513,14 @@ struct mm_struct { unsigned long start_brk, brk, start_stack; unsigned long arg_start, arg_end, env_start, env_end;
+#if defined(CONFIG_X86_64) && !defined(__GENKSYMS__) + unsigned long saved_auxv_padding[AT_VECTOR_SIZE_OLD]; /* for /proc/PID/auxv */ +#elif defined(CONFIG_X86_64) + unsigned long saved_auxv[AT_VECTOR_SIZE_OLD]; /* for /proc/PID/auxv */ +#else unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ +#endif +
/* * Special counters, in some configurations protected by the @@ -608,6 +620,9 @@ struct mm_struct { struct sp_group_master *sp_group_master; #endif
+#if defined(CONFIG_X86_64) && !defined(__GENKSYMS__) + unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ +#endif /* * The mm_cpumask needs to be at the end of mm_struct, because it * is dynamically sized based on nr_cpu_ids.