Unverified Commit eaef60e5 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!6105 fix some issues for arm64 machine check safe

Merge Pull Request from: @ci-robot 
 
PR sync from: Tong Tiangen <tongtiangen@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/CVASI4TUT52VKADQAHSPSDDFLCPRASGK/ 
The following optimization are made for feature "arm64: add machine
check safe support":

  1. Optimize do_sea() processing logic.
  2. Add new fixup type of the copy_to/from_user() memory error.
  3. Optimize repeated assembly codes in copy_mc_page.S and memcpy_mc.S.
  4. The below mailist patch hardening feature is incorporated:
     https://lore.kernel.org/lkml/20240204080144.7977-1-xueshuai@linux.alibaba.com/

Marc Zyngier (1):
  arm64: Get rid of ARM64_HAS_NO_HW_PREFETCH

Shuai Xue (3):
  ACPI: APEI: send SIGBUS to current task if synchronous memory error
    not recovered
  mm: memory-failure: move return value documentation to function
    declaration
  ACPI: APEI: handle synchronous exceptions in task work to send correct
    SIGBUS si_code

Tong Tiangen (12):
  Revert "kasan: fix the compilation error for memcpy_mcs()"
  Revert "arm64: add machine check safe sysctl interface"
  Revert "arm64: introduce copy_mc_to_kernel() implementation"
  Revert "arm64: support copy_mc_[user]_highpage()"
  Revert "mm/hwpoison: return -EFAULT when copy fail in
    copy_mc_[user]_highpage()"
  Revert "arm64: add uaccess to machine check safe"
  Revert "arm64: add support for machine check error safe"
  arm64: add support for ARCH_HAS_COPY_MC
  mm/hwpoison: return -EFAULT when copy fail in
    copy_mc_[user]_highpage()
  arm64: support copy_mc_[user]_highpage()
  arm64: introduce copy_mc_to_kernel() implementation
  arm64: add machine check safe sysctl interface


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I9GCZS 
 
Link:https://gitee.com/openeuler/kernel/pulls/6105

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parents ba2303ca 69730428
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -10,7 +10,8 @@
#define EX_TYPE_UACCESS_ERR_ZERO		2
#define EX_TYPE_KACCESS_ERR_ZERO		3
#define EX_TYPE_LOAD_UNALIGNED_ZEROPAD		4
#define EX_TYPE_COPY_MC_PAGE_ERR_ZERO	5
/* kernel access memory error safe */
#define EX_TYPE_KACCESS_ERR_ZERO_ME_SAFE	5

/* Data fields for EX_TYPE_UACCESS_ERR_ZERO */
#define EX_DATA_REG_ERR_SHIFT	0
@@ -52,16 +53,17 @@
#define _ASM_EXTABLE_UACCESS(insn, fixup)				\
	_ASM_EXTABLE_UACCESS_ERR_ZERO(insn, fixup, wzr, wzr)

#define _ASM_EXTABLE_COPY_MC_PAGE_ERR_ZERO(insn, fixup, err, zero)	\
#define _ASM_EXTABLE_KACCESS_ERR_ZERO_ME_SAFE(insn, fixup, err, zero)	\
	__ASM_EXTABLE_RAW(insn, fixup, 					\
			  EX_TYPE_COPY_MC_PAGE_ERR_ZERO,		\
			  EX_TYPE_KACCESS_ERR_ZERO_ME_SAFE,		\
			  (						\
			    EX_DATA_REG(ERR, err) |			\
			    EX_DATA_REG(ZERO, zero)			\
			  ))

#define _ASM_EXTABLE_COPY_MC_PAGE(insn, fixup)				\
	_ASM_EXTABLE_COPY_MC_PAGE_ERR_ZERO(insn, fixup, wzr, wzr)
#define _ASM_EXTABLE_KACCESS_ME_SAFE(insn, fixup)			\
	_ASM_EXTABLE_KACCESS_ERR_ZERO_ME_SAFE(insn, fixup, wzr, wzr)

/*
 * Create an exception table entry for uaccess `insn`, which will branch to `fixup`
 * when an unhandled fault is taken.
@@ -70,10 +72,6 @@
	_ASM_EXTABLE_UACCESS(\insn, \fixup)
	.endm

	.macro          _asm_extable_copy_mc_page, insn, fixup
	_ASM_EXTABLE_COPY_MC_PAGE(\insn, \fixup)
	.endm

/*
 * Create an exception table entry for `insn` if `fixup` is provided. Otherwise
 * do nothing.
@@ -84,6 +82,14 @@
	.endif
	.endm

/*
 * Create an exception table entry for kaccess me(memory error) safe `insn`, which
 * will branch to `fixup` when an unhandled fault is taken.
 */
	.macro          _asm_extable_kaccess_me_safe, insn, fixup
	_ASM_EXTABLE_KACCESS_ME_SAFE(\insn, \fixup)
	.endm

#else /* __ASSEMBLY__ */

#include <linux/stringify.h>
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ alternative_else_nop_endif
	.endm
#endif

#define KERNEL_ME_SAFE(l, x...)			\
9999:	x;					\
	_asm_extable_kaccess_me_safe	9999b, l

#define USER(l, x...)				\
9999:	x;					\
	_asm_extable_uaccess	9999b, l
+0 −4
Original line number Diff line number Diff line
@@ -172,10 +172,6 @@ lr .req x30 // link register
#define CPU_LE(code...) code
#endif

#define CPY_MC(l, x...)		\
9999:   x;			\
	_asm_extable_copy_mc_page    9999b, l

/*
 * Define a macro that constructs a 64-bit value by concatenating two
 * 32-bit registers. Note that on big endian systems the order of the
+1 −1
Original line number Diff line number Diff line
@@ -46,5 +46,5 @@ bool ex_handler_bpf(const struct exception_table_entry *ex,
#endif /* !CONFIG_BPF_JIT */

bool fixup_exception(struct pt_regs *regs);
bool fixup_exception_mc(struct pt_regs *regs);
bool fixup_exception_me(struct pt_regs *regs);
#endif
+4 −0
Original line number Diff line number Diff line
@@ -92,7 +92,11 @@ static inline bool try_page_mte_tagging(struct page *page)
void mte_zero_clear_page_tags(void *addr);
void mte_sync_tags(pte_t pte, unsigned int nr_pages);
void mte_copy_page_tags(void *kto, const void *kfrom);

#ifdef CONFIG_ARCH_HAS_COPY_MC
int mte_copy_mc_page_tags(void *kto, const void *kfrom);
#endif

void mte_thread_init_user(void);
void mte_thread_switch(struct task_struct *next);
void mte_cpu_setup(void);
Loading