TencentOS-kernel/arch
Tony Luck bbb3b95b7b Intel: x86/mce: Decode a kernel instruction to determine if it is copying from user
commit 300638101329e8f1569115f3d7197ef5ef754a3a upstream
Backport summary: Backport to kernel 5.4.49 to enhance MCA-R for copyin

All instructions copying data between kernel and user memory
are tagged with either _ASM_EXTABLE_UA or _ASM_EXTABLE_CPY
entries in the exception table. ex_fault_handler_type() returns
EX_HANDLER_UACCESS for both of these.

Recovery is only possible when the machine check was triggered
on a read from user memory. In this case the same strategy for
recovery applies as if the user had made the access in ring3. If
the fault was in kernel memory while copying to user there is no
current recovery plan.

For MOV and MOVZ instructions a full decode of the instruction
is done to find the source address. For MOVS instructions
the source address is in the %rsi register. The function
fault_in_kernel_space() determines whether the source address is
kernel or user, upgrade it from "static" so it can be used here.

Co-developed-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201006210910.21062-7-tony.luck@intel.com
Signed-off-by: Youquan Song <youquan.song@intel.com>
2021-04-25 14:31:16 +08:00
..
alpha alpha: fix annotation of io{read,write}{16,32}be() 2021-03-16 16:34:34 +08:00
arc arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC 2021-04-12 12:51:24 +08:00
arm ARM: dts: at91-sama5d27_som1: fix phy address to 7 2021-04-12 12:53:26 +08:00
arm64 arm64: kdump: update ppos when reading elfcorehdr 2021-04-12 12:53:30 +08:00
c6x Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
csky csky: Fixup abiv2 syscall_trace break a4 & a5 2021-03-16 16:28:56 +08:00
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-04-12 12:52:05 +08:00
hexagon hexagon: define ioremap_uc 2021-03-16 16:27:29 +08:00
ia64 ia64: fix ptrace(PTRACE_SYSCALL_INFO_EXIT) sign 2021-04-12 12:53:25 +08:00
m68k m68k: q40: Fix info-leak in rtc_ioctl 2021-03-16 16:36:33 +08:00
microblaze Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mips MIPS: Drop 32-bit asm string functions 2021-04-12 12:52:45 +08:00
nds32 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nios2 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
openrisc openrisc: Fix issue with get_user for 64-bit values 2021-03-16 16:39:36 +08:00
parisc parisc: Bump 64-bit IRQ stack size to 64 KB 2021-04-12 12:52:48 +08:00
powerpc powerpc/4xx: Fix build errors from mfdcr() 2021-04-12 12:53:21 +08:00
riscv riscv: Correct SPARSEMEM configuration 2021-04-12 12:53:18 +08:00
s390 s390/vtime: fix increased steal time accounting 2021-04-12 12:53:15 +08:00
sh sh: dma: fix kconfig dependency for G2_DMA 2021-04-12 12:51:39 +08:00
sparc sparc64: Fix opcode filtering in handling of no fault loads 2021-04-12 12:53:23 +08:00
um um: mm: check more comprehensively for stub changes 2021-04-12 12:52:40 +08:00
unicore32 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
x86 Intel: x86/mce: Decode a kernel instruction to determine if it is copying from user 2021-04-25 14:31:16 +08:00
xtensa xtensa: uaccess: Add missing __user to strncpy_from_user() prototype 2021-03-16 16:41:40 +08:00
.gitignore Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig Revert: "ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS" 2021-03-16 16:43:47 +08:00