android_kernel_xiaomi_sm8450/arch
Lee Jones ad10dd2113 x86/mm: Avoid using set_pgd() outside of real PGD pages
commit d082d48737c75d2b3cc1f972b8c8674c25131534 upstream.

KPTI keeps around two PGDs: one for userspace and another for the
kernel. Among other things, set_pgd() contains infrastructure to
ensure that updates to the kernel PGD are reflected in the user PGD
as well.

One side-effect of this is that set_pgd() expects to be passed whole
pages.  Unfortunately, init_trampoline_kaslr() passes in a single entry:
'trampoline_pgd_entry'.

When KPTI is on, set_pgd() will update 'trampoline_pgd_entry' (an
8-Byte globally stored [.bss] variable) and will then proceed to
replicate that value into the non-existent neighboring user page
(located +4k away), leading to the corruption of other global [.bss]
stored variables.

Fix it by directly assigning 'trampoline_pgd_entry' and avoiding
set_pgd().

[ dhansen: tweak subject and changelog ]

Fixes: 0925dda596 ("x86/mm/KASLR: Use only one PUD entry for real mode trampoline")
Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/all/20230614163859.924309-1-lee@kernel.org/g
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-28 10:28:09 +02:00
..
alpha alpha: fix R_ALPHA_LITERAL reloc for large modules 2023-03-17 08:45:14 +01:00
arc arch: setup PF_IO_WORKER threads like PF_KTHREAD 2023-01-04 11:39:22 +01:00
arm ARM: dts: vexpress: add missing cache properties 2023-06-21 15:45:35 +02:00
arm64 arm64/mm: mark private VM_FAULT_X defines as vm_fault_t 2023-06-09 10:30:11 +02:00
c6x c6x: add support for TIF_NOTIFY_SIGNAL 2023-01-04 11:39:21 +01:00
csky csky: Fix function name in csky_alignment() and die() 2023-02-01 08:23:20 +01:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-01 08:23:19 +01:00
hexagon hexagon: Fix function name in die() 2023-02-01 08:23:19 +01:00
ia64 ia64: fix an addr to taddr in huge_pte_offset() 2023-05-17 11:48:06 +02:00
m68k m68k: Move signal frame following exception on 68020/030 2023-05-30 12:57:56 +01:00
microblaze exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
mips Remove DECnet support from kernel 2023-06-21 15:45:38 +02:00
nds32 exit: Add and use make_task_dead. 2023-02-01 08:23:19 +01:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:45:37 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-17 11:48:03 +02:00
parisc parisc: Improve cache flushing for PCXL in arch_sync_dma_for_cpu() 2023-06-21 15:45:36 +02:00
powerpc Remove DECnet support from kernel 2023-06-21 15:45:38 +02:00
riscv riscv: fix kprobe __user string arg print fault issue 2023-06-14 11:09:57 +02:00
s390 s390/ptrace: fix PTRACE_GET_LAST_BREAK error handling 2023-04-26 11:27:37 +02:00
sh sh: nmi_debug: fix return value of __setup handler 2023-05-17 11:48:15 +02:00
sparc sparc: allow PM configs for sparc32 COMPILE_TEST 2023-03-11 16:39:40 +01:00
um um: Fix build w/o CONFIG_PM_SLEEP 2023-06-21 15:45:41 +02:00
x86 x86/mm: Avoid using set_pgd() outside of real PGD pages 2023-06-28 10:28:09 +02:00
xtensa xtensa: fix KASAN report for show_stack 2023-04-05 11:23:51 +02:00
.gitignore
Kconfig arch/cc: Introduce a function to check for confidential computing features 2021-11-18 14:04:32 +01:00