From: Felix Fu fuzhen5@huawei.com
Offering: HULK hulk inclusion category: feature bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAI881
-----------------------------------------
This reverts commit 37ef4cb859e9ef05ca3fd57132a8f20c6e45e5f1.
Signed-off-by: Felix Fu fuzhen5@huawei.com --- arch/arm/include/asm/Kbuild | 1 + arch/arm/include/asm/assembler.h | 16 ++++++--- arch/arm/include/asm/extable.h | 47 --------------------------- arch/arm/include/asm/futex.h | 6 ++-- arch/arm/include/asm/uaccess.h | 17 +++++++--- arch/arm/include/asm/word-at-a-time.h | 6 ++-- arch/arm/kernel/swp_emulate.c | 8 +++-- arch/arm/lib/backtrace.S | 13 +++++--- arch/arm/lib/getuser.S | 24 +++++++------- arch/arm/lib/putuser.S | 15 +++++---- arch/arm/mm/alignment.c | 24 +++++++++----- arch/arm/mm/extable.c | 2 +- arch/arm/nwfpe/entry.S | 6 ++-- scripts/sorttable.c | 2 +- 14 files changed, 89 insertions(+), 98 deletions(-) delete mode 100644 arch/arm/include/asm/extable.h
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild index 90c2964fd1bc..03657ff8fbe3 100644 --- a/arch/arm/include/asm/Kbuild +++ b/arch/arm/include/asm/Kbuild @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 generic-y += early_ioremap.h +generic-y += extable.h generic-y += flat.h generic-y += parport.h
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 7db72fba1540..aebe2c8f6a68 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h @@ -18,7 +18,6 @@ #endif
#include <asm/ptrace.h> -#include <asm/extable.h> #include <asm/opcodes-virt.h> #include <asm/asm-offsets.h> #include <asm/page.h> @@ -247,7 +246,10 @@ THUMB( fpreg .req r7 )
#define USERL(l, x...) \ 9999: x; \ - ex_entry 9999b, l; + .pushsection __ex_table,"a"; \ + .align 3; \ + .long 9999b,l; \ + .popsection
#define USER(x...) USERL(9001f, x)
@@ -474,7 +476,10 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) .error "Unsupported inc macro argument" .endif
- ex_entry 9999b, \abort + .pushsection __ex_table,"a" + .align 3 + .long 9999b, \abort + .popsection .endm
.macro usracc, instr, reg, ptr, inc, cond, rept, abort @@ -512,7 +517,10 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) .error "Unsupported inc macro argument" .endif
- ex_entry 9999b, \abort + .pushsection __ex_table,"a" + .align 3 + .long 9999b, \abort + .popsection .endr .endm
diff --git a/arch/arm/include/asm/extable.h b/arch/arm/include/asm/extable.h deleted file mode 100644 index 74b28c06284c..000000000000 --- a/arch/arm/include/asm/extable.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __ASM_EXTABLE_H -#define __ASM_EXTABLE_H - -#ifndef __ASSEMBLY__ - -/* - * The exception table consists of pairs of relative offsets: the first - * is the relative offset to an instruction that is allowed to fault, - * and the second is the relative offset at which the program should - * continue. No registers are modified, so it is entirely up to the - * continuation code to figure out what to do. - */ - -struct exception_table_entry { - int insn, fixup; -}; - -#define ARCH_HAS_RELATIVE_EXTABLE - -extern int fixup_exception(struct pt_regs *regs); - - /* - * ex_entry - place-relative extable entry - */ -asm(".macro ex_entry, insn, fixup \n" - ".pushsection __ex_table, "a", %progbits \n" - ".align 3 \n" - ".long \insn - . \n" - ".long \fixup - . \n" - ".popsection \n" - ".endm \n"); - -#else - - /* - * ex_entry - place-relative extable entry - */ - .macro ex_entry, insn, fixup - .pushsection __ex_table, "a", % progbits - .align 3 - .long \insn - . - .long \fixup - . - .popsection - .endm - -#endif -#endif diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h index 6921c58c6c7c..a9151884bc85 100644 --- a/arch/arm/include/asm/futex.h +++ b/arch/arm/include/asm/futex.h @@ -10,8 +10,10 @@
#define __futex_atomic_ex_table(err_reg) \ "3:\n" \ - " ex_entry 1b, 4f\n" \ - " ex_entry 2b, 4f\n" \ + " .pushsection __ex_table,"a"\n" \ + " .align 3\n" \ + " .long 1b, 4f, 2b, 4f\n" \ + " .popsection\n" \ " .pushsection .text.fixup,"ax"\n" \ " .align 2\n" \ "4: mov %0, " err_reg "\n" \ diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index f2d0e3f25ad9..c28f5ec21e41 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -278,7 +278,10 @@ do { \ " mov %1, #0\n" \ " b 2b\n" \ " .popsection\n" \ - " ex_entry 1b, 3b\n" \ + " .pushsection __ex_table,"a"\n" \ + " .align 3\n" \ + " .long 1b, 3b\n" \ + " .popsection" \ : "+r" (err), "=&r" (x) \ : "r" (addr), "i" (-EFAULT) \ : "cc") @@ -377,7 +380,10 @@ do { \ "3: mov %0, %3\n" \ " b 2b\n" \ " .popsection\n" \ - " ex_entry 1b, 3b\n" \ + " .pushsection __ex_table,"a"\n" \ + " .align 3\n" \ + " .long 1b, 3b\n" \ + " .popsection" \ : "+r" (err) \ : "r" (x), "r" (__pu_addr), "i" (-EFAULT) \ : "cc") @@ -433,8 +439,11 @@ do { \ "4: mov %0, %3\n" \ " b 3b\n" \ " .popsection\n" \ - " ex_entry 1b, 4b\n" \ - " ex_entry 2b, 4b\n" \ + " .pushsection __ex_table,"a"\n" \ + " .align 3\n" \ + " .long 1b, 4b\n" \ + " .long 2b, 4b\n" \ + " .popsection" \ : "+r" (err), "+r" (__pu_addr) \ : "r" (x), "i" (-EFAULT) \ : "cc") diff --git a/arch/arm/include/asm/word-at-a-time.h b/arch/arm/include/asm/word-at-a-time.h index a440ec1cd85b..352ab213520d 100644 --- a/arch/arm/include/asm/word-at-a-time.h +++ b/arch/arm/include/asm/word-at-a-time.h @@ -9,7 +9,6 @@ * Heavily based on the x86 algorithm. */ #include <linux/kernel.h> -#include <asm/extable.h>
struct word_at_a_time { const unsigned long one_bits, high_bits; @@ -86,7 +85,10 @@ static inline unsigned long load_unaligned_zeropad(const void *addr) #endif " b 2b\n" " .popsection\n" - " ex_entry 1b, 3b\n" + " .pushsection __ex_table,"a"\n" + " .align 3\n" + " .long 1b, 3b\n" + " .popsection" : "=&r" (ret), "=&r" (offset) : "r" (addr), "Qo" (*(unsigned long *)addr));
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c index c10bb1161ea2..fdce83c95acb 100644 --- a/arch/arm/kernel/swp_emulate.c +++ b/arch/arm/kernel/swp_emulate.c @@ -24,7 +24,6 @@ #include <linux/syscalls.h> #include <linux/perf_event.h>
-#include <asm/extable.h> #include <asm/opcodes.h> #include <asm/system_info.h> #include <asm/traps.h> @@ -47,8 +46,11 @@ "3: mov %0, %5\n" \ " b 2b\n" \ " .previous\n" \ - " ex_entry 0b, 3b\n" \ - " ex_entry 1b, 3b\n" \ + " .section __ex_table,"a"\n" \ + " .align 3\n" \ + " .long 0b, 3b\n" \ + " .long 1b, 3b\n" \ + " .previous" \ : "=&r" (res), "+r" (data), "=&r" (temp) \ : "r" (addr), "i" (-EAGAIN), "i" (-EFAULT) \ : "cc", "memory") diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S index d51679c84c1f..293a2716bd20 100644 --- a/arch/arm/lib/backtrace.S +++ b/arch/arm/lib/backtrace.S @@ -114,11 +114,14 @@ for_each_frame: tst frame, mask @ Check for address exceptions bl _printk no_frame: ldmfd sp!, {r4 - r9, pc} ENDPROC(c_backtrace) - - ex_entry 1001b, 1006b - ex_entry 1002b, 1006b - ex_entry 1003b, 1006b - ex_entry 1004b, 1006b + + .pushsection __ex_table,"a" + .align 3 + .long 1001b, 1006b + .long 1002b, 1006b + .long 1003b, 1006b + .long 1004b, 1006b + .popsection
.Lbad: .asciz "%sBacktrace aborted due to bad frame pointer <%p>\n" .align diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S index d120e0223a8c..c5e420750c48 100644 --- a/arch/arm/lib/getuser.S +++ b/arch/arm/lib/getuser.S @@ -27,7 +27,6 @@ #include <linux/linkage.h> #include <asm/assembler.h> #include <asm/errno.h> -#include <asm/extable.h> #include <asm/domain.h>
ENTRY(__get_user_1) @@ -150,18 +149,19 @@ _ASM_NOKPROBE(__get_user_bad) _ASM_NOKPROBE(__get_user_bad8)
.pushsection __ex_table, "a" - ex_entry 1b, __get_user_bad - ex_entry 2b, __get_user_bad + .long 1b, __get_user_bad + .long 2b, __get_user_bad #if __LINUX_ARM_ARCH__ < 6 - ex_entry 3b, __get_user_bad + .long 3b, __get_user_bad #endif - ex_entry 4b, __get_user_bad - ex_entry 5b, __get_user_bad8 - ex_entry 6b, __get_user_bad8 + .long 4b, __get_user_bad + .long 5b, __get_user_bad8 + .long 6b, __get_user_bad8 #ifdef __ARMEB__ - ex_entry 7b, __get_user_bad - ex_entry 8b, __get_user_bad8 - ex_entry 9b, __get_user_bad8 - ex_entry 10b, __get_user_bad8 - ex_entry 11b, __get_user_bad8 + .long 7b, __get_user_bad + .long 8b, __get_user_bad8 + .long 9b, __get_user_bad8 + .long 10b, __get_user_bad8 + .long 11b, __get_user_bad8 #endif +.popsection diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S index 1bb85192ba60..bdd8836dc5c2 100644 --- a/arch/arm/lib/putuser.S +++ b/arch/arm/lib/putuser.S @@ -27,7 +27,6 @@ #include <linux/linkage.h> #include <asm/assembler.h> #include <asm/errno.h> -#include <asm/extable.h> #include <asm/domain.h>
ENTRY(__put_user_1) @@ -84,11 +83,13 @@ __put_user_bad: ret lr ENDPROC(__put_user_bad)
- ex_entry 1b, __put_user_bad - ex_entry 2b, __put_user_bad +.pushsection __ex_table, "a" + .long 1b, __put_user_bad + .long 2b, __put_user_bad #if __LINUX_ARM_ARCH__ < 6 - ex_entry 3b, __put_user_bad + .long 3b, __put_user_bad #endif - ex_entry 4b, __put_user_bad - ex_entry 5b, __put_user_bad - ex_entry 6b, __put_user_bad + .long 4b, __put_user_bad + .long 5b, __put_user_bad + .long 6b, __put_user_bad +.popsection diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c index e788963ec4c8..f8dd0b3cc8e0 100644 --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c @@ -21,7 +21,6 @@ #include <linux/uaccess.h>
#include <asm/cp15.h> -#include <asm/extable.h> #include <asm/system_info.h> #include <asm/unaligned.h> #include <asm/opcodes.h> @@ -205,7 +204,10 @@ union offset_union { "3: mov %0, #1\n" \ " b 2b\n" \ " .popsection\n" \ - " ex_entry 1b, 3b\n" \ + " .pushsection __ex_table,"a"\n" \ + " .align 3\n" \ + " .long 1b, 3b\n" \ + " .popsection\n" \ : "=r" (err), "=&r" (val), "=r" (addr) \ : "0" (err), "2" (addr))
@@ -262,8 +264,11 @@ union offset_union { "4: mov %0, #1\n" \ " b 3b\n" \ " .popsection\n" \ - " ex_entry 1b, 4b\n" \ - " ex_entry 2b, 4b\n" \ + " .pushsection __ex_table,"a"\n" \ + " .align 3\n" \ + " .long 1b, 4b\n" \ + " .long 2b, 4b\n" \ + " .popsection\n" \ : "=r" (err), "=&r" (v), "=&r" (a) \ : "0" (err), "1" (v), "2" (a)); \ if (err) \ @@ -299,10 +304,13 @@ union offset_union { "6: mov %0, #1\n" \ " b 5b\n" \ " .popsection\n" \ - " ex_entry 1b, 6b\n" \ - " ex_entry 2b, 6b\n" \ - " ex_entry 3b, 6b\n" \ - " ex_entry 4b, 6b\n" \ + " .pushsection __ex_table,"a"\n" \ + " .align 3\n" \ + " .long 1b, 6b\n" \ + " .long 2b, 6b\n" \ + " .long 3b, 6b\n" \ + " .long 4b, 6b\n" \ + " .popsection\n" \ : "=r" (err), "=&r" (v), "=&r" (a) \ : "0" (err), "1" (v), "2" (a)); \ if (err) \ diff --git a/arch/arm/mm/extable.c b/arch/arm/mm/extable.c index 46c4a8a7f5da..fc33564597b8 100644 --- a/arch/arm/mm/extable.c +++ b/arch/arm/mm/extable.c @@ -11,7 +11,7 @@ int fixup_exception(struct pt_regs *regs)
fixup = search_exception_tables(instruction_pointer(regs)); if (fixup) { - regs->ARM_pc = (unsigned long)&fixup->fixup + fixup->fixup; + regs->ARM_pc = fixup->fixup; #ifdef CONFIG_THUMB2_KERNEL /* Clear the IT state to avoid nasty surprises in the fixup */ regs->ARM_cpsr &= ~PSR_IT_MASK; diff --git a/arch/arm/nwfpe/entry.S b/arch/arm/nwfpe/entry.S index 366422cdb882..354d297a193b 100644 --- a/arch/arm/nwfpe/entry.S +++ b/arch/arm/nwfpe/entry.S @@ -9,7 +9,6 @@ */ #include <linux/linkage.h> #include <asm/assembler.h> -#include <asm/extable.h> #include <asm/opcodes.h>
/* This is the kernel's entry point into the floating point emulator. @@ -110,7 +109,10 @@ next: .Lfix: ret r9 @ let the user eat segfaults .popsection
- ex_entry .Lx1, .Lfix + .pushsection __ex_table,"a" + .align 3 + .long .Lx1, .Lfix + .popsection
@ @ Check whether the instruction is a co-processor instruction. diff --git a/scripts/sorttable.c b/scripts/sorttable.c index 09a6e53b2199..83cdb843d92f 100644 --- a/scripts/sorttable.c +++ b/scripts/sorttable.c @@ -312,12 +312,12 @@ static int do_file(char const *const fname, void *addr) break; case EM_PARISC: case EM_PPC: - case EM_ARM: case EM_PPC64: custom_sort = sort_relative_table; break; case EM_ARCOMPACT: case EM_ARCV2: + case EM_ARM: case EM_MICROBLAZE: case EM_MIPS: case EM_XTENSA: