linux/arch/x86
Lu Baolu e37d5a2d60 iommu/sva: invalidate stale IOTLB entries for kernel address space
Introduce a new IOMMU interface to flush IOTLB paging cache entries for
the CPU kernel address space.  This interface is invoked from the x86
architecture code that manages combined user and kernel page tables,
specifically before any kernel page table page is freed and reused.

This addresses the main issue with vfree() which is a common occurrence
and can be triggered by unprivileged users.  While this resolves the
primary problem, it doesn't address some extremely rare case related to
memory unplug of memory that was present as reserved memory at boot, which
cannot be triggered by unprivileged users.  The discussion can be found at
the link below.

Enable SVA on x86 architecture since the IOMMU can now receive
notification to flush the paging cache before freeing the CPU kernel page
table pages.

Link: https://lkml.kernel.org/r/20251022082635.2462433-9-baolu.lu@linux.intel.com
Link: https://lore.kernel.org/linux-iommu/04983c62-3b1d-40d4-93ae-34ca04b827e5@intel.com/
Co-developed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Suggested-by: Jann Horn <jannh@google.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Betkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robin Murohy <robin.murphy@arm.com>
Cc: Thomas Gleinxer <tglx@linutronix.de>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Cc: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Cc: Yi Lai <yi1.lai@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-11-16 17:28:18 -08:00
..
boot - Simplify inline asm flag output operands now that the minimum compiler 2025-10-11 10:51:14 -07:00
coco Merge branch 'x86/apic' into x86/sev, to resolve conflict 2025-09-05 09:01:42 +02:00
configs x86/xen: select HIBERNATE_CALLBACKS more directly 2025-09-08 20:10:20 +02:00
crypto - Simplify inline asm flag output operands now that the minimum compiler 2025-10-11 10:51:14 -07:00
entry - Remove a bunch of asm implementing condition flags testing in KVM's 2025-10-11 11:19:16 -07:00
events perf/x86/intel/uncore: Add uncore PMU support for Wildcat Lake 2025-10-29 11:31:44 +01:00
hyperv - Remove a bunch of asm implementing condition flags testing in KVM's 2025-10-11 11:19:16 -07:00
ia32
include Miscellaneous fixes: 2025-11-08 09:01:11 -08:00
kernel mm: consistently use current->mm in mm_get_unmapped_area() 2025-11-16 17:27:57 -08:00
kvm KVM x86 fixes for 6.18: 2025-10-18 10:25:43 +02:00
lib - Remove a bunch of asm implementing condition flags testing in KVM's 2025-10-11 11:19:16 -07:00
math-emu
mm x86/mm: use pagetable_free() 2025-11-16 17:28:17 -08:00
net bpf: Do not audit capability check in do_jit() 2025-10-21 18:22:47 -07:00
pci PCI: Add Extended Tag + MRRS quirk for Xeon 6 2025-08-11 15:00:51 -05:00
platform - Remove a bunch of asm implementing condition flags testing in KVM's 2025-10-11 11:19:16 -07:00
power x86/smp: PM/hibernate: Split arch_resume_nosmt() 2025-06-07 14:22:56 +02:00
purgatory kcfi: Rename CONFIG_CFI_CLANG to CONFIG_CFI 2025-09-24 14:29:14 -07:00
ras
realmode - The 11 patch series "Add folio_mk_pte()" from Matthew Wilcox 2025-05-31 15:44:16 -07:00
tools - Add functionality to provide runtime firmware updates for the non-x86 parts 2025-09-30 13:40:35 -07:00
um um: Centralize stub size calculations 2025-09-10 14:23:52 +02:00
video fbcon: Use screen info to find primary device 2025-09-10 09:35:33 -05:00
virt - Make TDX and kexec work together 2025-10-04 10:01:30 -07:00
xen x86/xen: select HIBERNATE_CALLBACKS more directly 2025-09-08 20:10:20 +02:00
.gitignore
Kbuild x86/kbuild: Incorporate boot/startup/ via Kbuild makefile 2025-09-03 17:59:59 +02:00
Kconfig iommu/sva: invalidate stale IOTLB entries for kernel address space 2025-11-16 17:28:18 -08:00
Kconfig.assembler x86/kconfig: Remove CONFIG_AS_AVX512 2025-08-21 14:35:01 +02:00
Kconfig.cpu
Kconfig.cpufeatures x86/mm/64: Make 5-level paging support unconditional 2025-05-17 10:38:16 +02:00
Kconfig.debug
Makefile rust: kbuild: support -Cjump-tables=n for Rust 1.93.0 2025-11-04 19:11:39 +01:00
Makefile_32.cpu
Makefile.um