This patch fix a few compilation errors with ILP32 support using openeuler_defcofig.
Changes in v3: - Revert the problem patch instead of update elf.h.
Jinjie Ruan (3): Revert "Kconfig: regularize selection of CONFIG_BINFMT_ELF" arm64: Fix compilation error with ILP32 support config: Disable CONFIG_COMPAT_BINFMT_ELF as default
arch/arm64/Kconfig | 2 +- arch/arm64/configs/openeuler_defconfig | 1 - arch/arm64/include/asm/seccomp.h | 4 ++-- arch/mips/Kconfig | 2 ++ arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/x86/Kconfig | 1 + fs/Kconfig.binfmt | 2 +- 10 files changed, 11 insertions(+), 5 deletions(-)
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8S6IA
-------------------------------------------------
This reverts commit 41026c343540e33627e23c8a91ebb679a7c0f89c.
Since commit 7de3ab4c3dd9 ("arm64: introduce binfmt_elf32.c"), whether it is ILP32 or AARCH32_EL0, fs/compat_binfmt.c is not used for arm64. So it is not reasonable to be default y for COMPAT_BINFMT_ELF and revert it to to make all architectures to individually select it.
Signed-off-by: Jinjie Ruan ruanjinjie@huawei.com --- arch/mips/Kconfig | 2 ++ arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/x86/Kconfig | 1 + fs/Kconfig.binfmt | 2 +- 7 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index bc8421859006..41626c53f211 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -3085,6 +3085,7 @@ config MIPS32_O32 select ARCH_WANT_OLD_COMPAT_IPC select COMPAT select MIPS32_COMPAT + select COMPAT_BINFMT_ELF help Select this option if you want to run o32 binaries. These are pure 32-bit binaries as used by the 32-bit Linux/MIPS port. Most of @@ -3097,6 +3098,7 @@ config MIPS32_N32 depends on 64BIT select ARCH_WANT_COMPAT_IPC_PARSE_VERSION select COMPAT + select COMPAT_BINFMT_ELF select MIPS32_COMPAT help Select this option if you want to run n32 binaries. These are diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 68cbe666510a..d8c3e78461c3 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -348,6 +348,7 @@ source "kernel/Kconfig.hz" config COMPAT def_bool y depends on 64BIT + select COMPAT_BINFMT_ELF if BINFMT_ELF
config AUDIT_ARCH def_bool y diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c253be653876..57e0bd90f40e 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -333,6 +333,7 @@ config COMPAT depends on PPC64 depends on !CC_IS_CLANG || CLANG_VERSION >= 120000 default y if !CPU_LITTLE_ENDIAN + select COMPAT_BINFMT_ELF select ARCH_WANT_OLD_COMPAT_IPC select COMPAT_OLD_SIGACTION
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index ae29e4392664..ad824ffbb159 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -444,6 +444,7 @@ config COMMAND_LINE_SIZE config COMPAT def_bool y prompt "Kernel support for 31 bit emulation" + select COMPAT_BINFMT_ELF if BINFMT_ELF select ARCH_WANT_OLD_COMPAT_IPC select COMPAT_OLD_SIGACTION select HAVE_UID16 diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 49849790e66d..1c76156d0968 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -488,6 +488,7 @@ config COMPAT bool depends on SPARC64 default y + select COMPAT_BINFMT_ELF select HAVE_UID16 select ARCH_WANT_OLD_COMPAT_IPC select COMPAT_OLD_SIGACTION diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 66bfabae8814..edc67cf22dc5 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2977,6 +2977,7 @@ config COMPAT_32 config COMPAT def_bool y depends on IA32_EMULATION || X86_X32_ABI + select COMPAT_BINFMT_ELF if BINFMT_ELF
config COMPAT_FOR_U64_ALIGNMENT def_bool y diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt index f5693164ca9a..2b864f363a36 100644 --- a/fs/Kconfig.binfmt +++ b/fs/Kconfig.binfmt @@ -39,7 +39,7 @@ config BINFMT_ELF_KUNIT_TEST compat_binfmt_elf KUnit test is also created.
config COMPAT_BINFMT_ELF - def_bool y + bool depends on COMPAT && BINFMT_ELF select ELFCORE
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8S6IA
-------------------------------------------------
This patch fix the following compilation errors with ILP32 support using openeuler_defcofig.
When ILP32 support is enabled, compilation on ARM64 would complain about an undeclared __NR_compat_syscalls, since commit b16c8a680a2b ("arm64: ilp32: introduce syscall table for ILP32") changes the config that __NR_compat_syscalls depends on but commit dbece8b041f3 ("arm64: rename COMPAT to AARCH32_EL0") ignores it for __NR_compat_syscalls. Modify the config for SECCOMP_ARCH_COMPAT_NR accordingly.
And commit dbece8b041f3 ("arm64: rename COMPAT to AARCH32_EL0") ignores ARM64_ERRATU_1742098 which only depends on AARCH32_EL0 but not ARM64_ILP32.
./arch/arm64/include/asm/seccomp.h:57:33: error: ‘__NR_compat_syscalls’ undeclared here (not in a function); did you mean ‘in_compat_syscall’? 57 | # define SECCOMP_ARCH_COMPAT_NR __NR_compat_syscalls
./arch/arm64/kernel/cpufeature.c:2200:17: error: ‘a32_elf_hwcap2’ undeclared (first use in this function); did you mean ‘elf_hwcap’? 2200 | a32_elf_hwcap2 &= ~COMPAT_HWCAP2_AES; | ^~~~~~~~~~~~~~ | elf_hwcap
Fixes: dbece8b041f3 ("arm64: rename COMPAT to AARCH32_EL0") Signed-off-by: Jinjie Ruan ruanjinjie@huawei.com --- arch/arm64/Kconfig | 2 +- arch/arm64/include/asm/seccomp.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 42079bfdf40a..42f31d37ce23 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -568,7 +568,7 @@ config ARM64_ERRATUM_834220
config ARM64_ERRATUM_1742098 bool "Cortex-A57/A72: 1742098: ELR recorded incorrectly on interrupt taken between cryptographic instructions in a sequence" - depends on COMPAT + depends on AARCH32_EL0 default y help This option removes the AES hwcap for aarch32 user-space to diff --git a/arch/arm64/include/asm/seccomp.h b/arch/arm64/include/asm/seccomp.h index a6be48b9225a..bc3ab2468f03 100644 --- a/arch/arm64/include/asm/seccomp.h +++ b/arch/arm64/include/asm/seccomp.h @@ -52,10 +52,10 @@ static inline const int *get_compat_mode1_syscalls(void) #define SECCOMP_ARCH_NATIVE AUDIT_ARCH_AARCH64 #define SECCOMP_ARCH_NATIVE_NR NR_syscalls #define SECCOMP_ARCH_NATIVE_NAME "aarch64" -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 # define SECCOMP_ARCH_COMPAT AUDIT_ARCH_ARM # define SECCOMP_ARCH_COMPAT_NR __NR_compat_syscalls # define SECCOMP_ARCH_COMPAT_NAME "arm" -#endif +#endif /* CONFIG_AARCH32_EL0 */
#endif /* _ASM_SECCOMP_H */
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8S6IA
-------------------------------------------------
This patchset revert commit 41026c343540 ("Kconfig: regularize selection of CONFIG_BINFMT_ELF"), so make CONFIG_COMPAT_BINFMT_ELF disable as default.
Signed-off-by: Jinjie Ruan ruanjinjie@huawei.com --- arch/arm64/configs/openeuler_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index c5bb420feb86..298c2f5b6fc2 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -985,7 +985,6 @@ CONFIG_FREEZER=y # Executable file formats # CONFIG_BINFMT_ELF=y -CONFIG_COMPAT_BINFMT_ELF=y CONFIG_ARCH_BINFMT_ELF_STATE=y CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y CONFIG_ARCH_HAVE_ELF_PROT=y
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3737 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/5...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3737 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/5...