OpenCloudOS-Kernel/arch/x86/mm/pat
Juergen Gross edcdeb8a4f x86/pat: Fix W^X violation false-positives when running as Xen PV guest
[ Upstream commit 5bc8b0f5dac04cd4ebe47f8090a5942f2f2647ef ]

When running as Xen PV guest in some cases W^X violation WARN()s have
been observed. Those WARN()s are produced by verify_rwx(), which looks
into the PTE to verify that writable kernel pages have the NX bit set
in order to avoid code modifications of the kernel by rogue code.

As the NX bits of all levels of translation entries are or-ed and the
RW bits of all levels are and-ed, looking just into the PTE isn't enough
for the decision that a writable page is executable, too.

When running as a Xen PV guest, the direct map PMDs and kernel high
map PMDs share the same set of PTEs. Xen kernel initialization will set
the NX bit in the direct map PMD entries, and not the shared PTEs.

Fixes: 652c5bf380 ("x86/mm: Refuse W^X violations")
Reported-by: Jason Andryuk <jandryuk@gmail.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240412151258.9171-5-jgross@suse.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:11:42 +02:00
..
Makefile
cpa-test.c treewide: use get_random_u32_below() instead of deprecated function 2022-11-18 02:15:15 +01:00
memtype.c x86/mm/pat: fix VM_PAT handling in COW mappings 2024-04-10 16:36:03 +02:00
memtype.h
memtype_interval.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
set_memory.c x86/pat: Fix W^X violation false-positives when running as Xen PV guest 2024-06-12 11:11:42 +02:00