android_kernel_samsung_sm8650/arch
Lee Jones 364fdcbb03 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 11:12:27 +02:00
..
alpha alpha: fix R_ALPHA_LITERAL reloc for large modules 2023-03-17 08:50:31 +01:00
arc ARC: mm: fix leakage of memory allocated for PTE 2022-10-17 16:32:12 -07:00
arm ARM: dts: vexpress: add missing cache properties 2023-06-21 16:00:52 +02:00
arm64 arm64: dts: rockchip: Fix rk356x PCIe register and range mappings 2023-06-28 11:12:27 +02:00
csky - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
hexagon - hfs and hfsplus kmap API modernization from Fabio Francesco 2022-10-12 11:00:22 -07:00
ia64 ia64: fix an addr to taddr in huge_pte_offset() 2023-05-11 23:03:40 +09:00
loongarch LoongArch: Fix perf event id calculation 2023-06-21 16:00:54 +02:00
m68k m68k: Move signal frame following exception on 68020/030 2023-05-30 14:03:18 +01:00
microblaze kbuild: fix "cat: .version: No such file or directory" 2022-11-24 09:26:02 +09:00
mips MIPS: Prefer cc-option for additions to cflags 2023-06-21 16:01:03 +02:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 16:00:54 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-11 23:03:35 +09:00
parisc parisc: Delete redundant register definitions in <asm/assembly.h> 2023-06-21 16:01:02 +02:00
powerpc powerpc/purgatory: remove PGO flags 2023-06-21 16:00:55 +02:00
riscv riscv/purgatory: remove PGO flags 2023-06-21 16:00:55 +02:00
s390 s390/topology: honour nr_cpu_ids when adding CPUs 2023-06-09 10:34:13 +02:00
sh sh: nmi_debug: fix return value of __setup handler 2023-05-17 11:53:45 +02:00
sparc sparc: allow PM configs for sparc32 COMPILE_TEST 2023-03-10 09:33:27 +01:00
um um: harddog: fix modular build 2023-06-09 10:34:10 +02:00
x86 x86/mm: Avoid using set_pgd() outside of real PGD pages 2023-06-28 11:12:27 +02:00
xtensa xtensa: add __bswap{si,di}2 helpers 2023-05-30 14:03:18 +01:00
.gitignore
Kconfig ftrace: Allow WITH_ARGS flavour of graph tracer with shadow call stack 2022-12-31 13:32:45 +01:00