]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm64: extable: make uaaccess helper use extable type EX_TYPE_UACCESS_ERR_ZERO
authorTong Tiangen <tongtiangen@huawei.com>
Tue, 21 Jun 2022 07:26:32 +0000 (07:26 +0000)
committerWill Deacon <will@kernel.org>
Tue, 28 Jun 2022 11:11:47 +0000 (12:11 +0100)
Currnetly, the extable type used by __arch_copy_from/to_user() is
EX_TYPE_FIXUP. In fact, It is more clearly to use meaningful
EX_TYPE_UACCESS_*.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
Link: https://lore.kernel.org/r/20220621072638.1273594-5-tongtiangen@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/asm-extable.h
arch/arm64/include/asm/asm-uaccess.h

index 2e1e6bc33bcd510b7205f84d98f92e6c7777a375..73266553f8a2066f264b88726a646b6cbc7ce71a 100644 (file)
        _ASM_EXTABLE(\insn, \fixup)
        .endm
 
+/*
+ * Create an exception table entry for uaccess `insn`, which will branch to `fixup`
+ * when an unhandled fault is taken.
+ */
+       .macro          _asm_extable_uaccess, insn, fixup
+       _ASM_EXTABLE_UACCESS(\insn, \fixup)
+       .endm
+
 /*
  * Create an exception table entry for `insn` if `fixup` is provided. Otherwise
  * do nothing.
index 0557af834e036958e1555097beafe55042b1d7b4..75b211c98dead5e6863718bb12f6584d8d4a2243 100644 (file)
@@ -61,7 +61,7 @@ alternative_else_nop_endif
 
 #define USER(l, x...)                          \
 9999:  x;                                      \
-       _asm_extable    9999b, l
+       _asm_extable_uaccess    9999b, l
 
 /*
  * Generate the assembly for LDTR/STTR with exception table entries.
@@ -73,8 +73,8 @@ alternative_else_nop_endif
 8889:          ldtr    \reg2, [\addr, #8];
                add     \addr, \addr, \post_inc;
 
-               _asm_extable    8888b,\l;
-               _asm_extable    8889b,\l;
+               _asm_extable_uaccess    8888b, \l;
+               _asm_extable_uaccess    8889b, \l;
        .endm
 
        .macro user_stp l, reg1, reg2, addr, post_inc
@@ -82,14 +82,14 @@ alternative_else_nop_endif
 8889:          sttr    \reg2, [\addr, #8];
                add     \addr, \addr, \post_inc;
 
-               _asm_extable    8888b,\l;
-               _asm_extable    8889b,\l;
+               _asm_extable_uaccess    8888b,\l;
+               _asm_extable_uaccess    8889b,\l;
        .endm
 
        .macro user_ldst l, inst, reg, addr, post_inc
 8888:          \inst           \reg, [\addr];
                add             \addr, \addr, \post_inc;
 
-               _asm_extable    8888b,\l;
+               _asm_extable_uaccess    8888b, \l;
        .endm
 #endif