An error occurred while fetching folder content.
x86/speculation/l1tf: Limit swap file size to MAX_PA/2
Andi Kleen authored
commit 377eeaa8

 upstream.

For the L1TF workaround its necessary to limit the swap file size to below
MAX_PA/2, so that the higher bits of the swap offset inverted never point
to valid memory.

Add a mechanism for the architecture to override the swap file size check
in swapfile.c and add a x86 specific max swapfile check function that
enforces that limit.

The check is only enabled if the CPU is vulnerable to L1TF.

In VMs with 42bit MAX_PA the typical limit is 2TB now, on a native system
with 46bit PA it is 32TB. The limit is only per individual swap file, so
it's always possible to exceed these limits with multiple swap files or
partitions.
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Acked-by: default avatarDave Hansen <dave.hansen@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
1655bd14
Name Last commit Last update
..
kasan kasan: fix shadow_size calculation error in kasan_module_alloc
Kconfig Merge tag 'libnvdimm-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Kconfig.debug kmemcheck: rip it out
Makefile mm: restructure memfd code
backing-dev.c bdi: Fix another oops in wb_workfn()
balloon_compaction.c virtio_balloon: fix deadlock on OOM
bootmem.c mm: docs: fix parameter names mismatch
cleancache.c mm: use octal not symbolic permissions
cma.c Revert "mm/cma: manage the memory of the CMA area by using the ZONE_MOVABLE"
cma.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license
cma_debug.c mm: use octal not symbolic permissions
compaction.c mm: use octal not symbolic permissions
debug.c mm: teach dump_page() to correctly output poisoned struct pages
debug_page_ref.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license
dmapool.c mm: use octal not symbolic permissions
early_ioremap.c mm/early_ioremap: Fix boot hang with earlyprintk=efi,keep
fadvise.c mm: add ksys_fadvise64_64() helper; remove in-kernel call to sys_fadvise64_64()
failslab.c mm: use octal not symbolic permissions
filemap.c mm: use new return type vm_fault_t
frame_vector.c mm/frame_vector.c: release a semaphore in 'get_vaddr_frames()'
frontswap.c mm: use octal not symbolic permissions
gup.c mm: do not bug_on on incorrect length in __mm_populate()
gup_benchmark.c treewide: kvzalloc() -> kvcalloc()
highmem.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license
hmm.c mm: introduce MEMORY_DEVICE_FS_DAX and CONFIG_DEV_PAGEMAP_OPS
huge_memory.c
hugetlb.c
hugetlb_cgroup.c
hwpoison-inject.c
init-mm.c
internal.h
interval_tree.c
khugepaged.c
kmemleak-test.c
kmemleak.c
ksm.c
list_lru.c
maccess.c
madvise.c
memblock.c
memcontrol.c
memfd.c
memory-failure.c
memory.c
memory_hotplug.c
mempolicy.c
mempool.c
memtest.c
migrate.c
mincore.c
mlock.c
mm_init.c
mmap.c
mmu_context.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nobootmem.c
nommu.c
oom_kill.c
page-writeback.c
page_alloc.c
page_counter.c
page_ext.c
page_idle.c
page_io.c
page_isolation.c
page_owner.c
page_poison.c
page_vma_mapped.c
pagewalk.c
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c
pgtable-generic.c
process_vm_access.c
quicklist.c
readahead.c
rmap.c
rodata_test.c
shmem.c
slab.c
slab.h
slab_common.c
slob.c
slub.c
sparse-vmemmap.c
sparse.c
swap.c
swap_cgroup.c
swap_slots.c
swap_state.c
swapfile.c
truncate.c
usercopy.c
userfaultfd.c