Most #ifdef CONFIG_COMPAT in arch/arm64 really are about 32-bit specifically. Many have been converted already, but a few remain: take care of those.
This change is mostly non-functional, with the following exception:
* arch_parse_elf_property() was incorrectly skipped in compat64. This had no impact on Morello as the only allocated property if for BTI, which is not implemented on Morello.
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- arch/arm64/include/asm/elf.h | 4 ++-- arch/arm64/include/asm/fpsimd.h | 2 +- arch/arm64/include/asm/mmu.h | 2 +- arch/arm64/include/asm/processor.h | 8 ++++---- arch/arm64/include/asm/ptrace.h | 2 +- arch/arm64/include/asm/seccomp.h | 2 +- arch/arm64/include/asm/unistd.h | 6 +++++- arch/arm64/kernel/entry-common.c | 6 +++--- arch/arm64/kernel/traps.c | 4 ++-- arch/arm64/mm/init.c | 2 +- 10 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 4c556ac15e04..b54070e80867 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -186,7 +186,7 @@ extern int purecap_setup_additional_pages(struct linux_binprm *bprm, #endif /* CONFIG_CHERI_PURECAP_UABI */
/* 1GB of VA */ -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 #define STACK_RND_MASK (test_thread_flag(TIF_32BIT) ? \ 0x7ff >> (PAGE_SHIFT - 12) : \ 0x3ffff >> (PAGE_SHIFT - 12)) @@ -313,7 +313,7 @@ static inline int arch_parse_elf_property(u32 type, const void *data, struct arch_elf_state *arch) { /* No known properties for AArch32 yet */ - if (IS_ENABLED(CONFIG_COMPAT) && compat) + if (IS_ENABLED(CONFIG_COMPAT32) && compat) return 0;
if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) { diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h index 50e5f25d3024..62a5e4688883 100644 --- a/arch/arm64/include/asm/fpsimd.h +++ b/arch/arm64/include/asm/fpsimd.h @@ -21,7 +21,7 @@ #include <linux/stddef.h> #include <linux/types.h>
-#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 /* Masks for extracting the FPSR and FPCR from the FPSCR */ #define VFP_FPSCR_STAT_MASK 0xf800009f #define VFP_FPSCR_CTRL_MASK 0x07f79f00 diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index 2fcf51231d6e..12a7889f0a37 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -19,7 +19,7 @@
typedef struct { atomic64_t id; -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 void *sigpage; #endif refcount_t pinned; diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 472d4332715f..ab02589247f4 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -55,7 +55,7 @@ #define TASK_SIZE_64 (UL(1) << vabits_actual) #define TASK_SIZE_MAX (UL(1) << VA_BITS)
-#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 #if defined(CONFIG_ARM64_64K_PAGES) && defined(CONFIG_KUSER_HELPERS) /* * With CONFIG_ARM64_64K_PAGES enabled, the last page is occupied @@ -74,7 +74,7 @@ #else #define TASK_SIZE TASK_SIZE_64 #define DEFAULT_MAP_WINDOW DEFAULT_MAP_WINDOW_64 -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_COMPAT32 */
#ifdef CONFIG_ARM64_FORCE_52BIT #define STACK_TOP_MAX TASK_SIZE_64 @@ -84,13 +84,13 @@ #define TASK_UNMAPPED_BASE (PAGE_ALIGN(DEFAULT_MAP_WINDOW / 4)) #endif /* CONFIG_ARM64_FORCE_52BIT */
-#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 #define AARCH32_VECTORS_BASE 0xffff0000 #define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ AARCH32_VECTORS_BASE : STACK_TOP_MAX) #else #define STACK_TOP STACK_TOP_MAX -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_COMPAT32 */
#ifndef CONFIG_ARM64_FORCE_52BIT #define arch_get_mmap_end(addr, len, flags) \ diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index 8746d88338d3..5d682f0ccd3f 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h @@ -225,7 +225,7 @@ static inline void forget_syscall(struct pt_regs *regs)
#define arch_has_single_step() (1)
-#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 #define compat_thumb_mode(regs) \ (((regs)->pstate & PSR_AA32_T_BIT)) #else diff --git a/arch/arm64/include/asm/seccomp.h b/arch/arm64/include/asm/seccomp.h index 65958a8f661c..4ef492fa0528 100644 --- a/arch/arm64/include/asm/seccomp.h +++ b/arch/arm64/include/asm/seccomp.h @@ -15,7 +15,7 @@ #define __NR_seccomp_write_32 __NR_compat_write #define __NR_seccomp_exit_32 __NR_compat_exit #define __NR_seccomp_sigreturn_32 __NR_compat_rt_sigreturn -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_COMPAT32 */
#include <asm-generic/seccomp.h>
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 531effca5f1f..12863ce079e4 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -2,7 +2,7 @@ /* * Copyright (C) 2012 ARM Ltd. */ -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 #define __ARCH_WANT_COMPAT_STAT #define __ARCH_WANT_COMPAT_STAT64 #define __ARCH_WANT_SYS_GETHOSTNAME @@ -42,6 +42,10 @@ #define __NR_compat_syscalls 457 #endif
+#ifdef CONFIG_COMPAT64 +#define __NR_compat_syscalls __NR_syscalls +#endif + #define __ARCH_WANT_SYS_CLONE
#ifndef __COMPAT_SYSCALL_NR diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 0fc94207e69a..63cab2184e11 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -801,7 +801,7 @@ asmlinkage void noinstr el0t_64_error_handler(struct pt_regs *regs) __el0_error_handler_common(regs); }
-#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr) { enter_from_user_mode(regs); @@ -877,12 +877,12 @@ asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs) { __el0_error_handler_common(regs); } -#else /* CONFIG_COMPAT */ +#else /* CONFIG_COMPAT32 */ UNHANDLED(el0t, 32, sync) UNHANDLED(el0t, 32, irq) UNHANDLED(el0t, 32, fiq) UNHANDLED(el0t, 32, error) -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_COMPAT32 */
#ifdef CONFIG_VMAP_STACK asmlinkage void noinstr __noreturn handle_bad_stack(struct pt_regs *regs) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index f2653f40e86d..5e9744ce727b 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -302,7 +302,7 @@ void arm64_notify_die(const char *str, struct pt_regs *regs, } }
-#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 #define PSTATE_IT_1_0_SHIFT 25 #define PSTATE_IT_1_0_MASK (0x3 << PSTATE_IT_1_0_SHIFT) #define PSTATE_IT_7_2_SHIFT 10 @@ -684,7 +684,7 @@ static const struct sys64_hook sys64_hooks[] = { {}, };
-#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 static bool cp15_cond_valid(unsigned long esr, struct pt_regs *regs) { int cond; diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 74c1db8ce271..c6c0b7df1986 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -390,7 +390,7 @@ void __init mem_init(void) * Check boundaries twice: Some fundamental inconsistencies can be * detected at build time already. */ -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT32 BUILD_BUG_ON(TASK_SIZE_32 > DEFAULT_MAP_WINDOW_64); #endif