summaryrefslogtreecommitdiff
path: root/mm/Kconfig
diff options
context:
space:
mode:
Diffstat (limited to 'mm/Kconfig')
-rw-r--r--mm/Kconfig168
1 files changed, 104 insertions, 64 deletions
diff --git a/mm/Kconfig b/mm/Kconfig
index ebd8ea353687..604c58199acb 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -125,8 +125,6 @@ config ZSWAP_COMPRESSOR_DEFAULT
config ZSMALLOC
tristate
-if ZSMALLOC
-
menu "Zsmalloc allocator options"
depends on ZSMALLOC
@@ -161,8 +159,6 @@ config ZSMALLOC_CHAIN_SIZE
endmenu
-endif
-
menu "Slab allocator options"
config SLUB
@@ -172,6 +168,7 @@ config SLUB
config KVFREE_RCU_BATCHED
def_bool y
depends on !SLUB_TINY && !TINY_RCU
+ depends on !RCU_STRICT_GRACE_PERIOD
config SLUB_TINY
bool "Configure for minimal memory footprint"
@@ -247,22 +244,75 @@ config SLUB_STATS
out which slabs are relevant to a particular load.
Try running: slabinfo -DA
-config RANDOM_KMALLOC_CACHES
- default n
+config KMALLOC_PARTITION_CACHES
depends on !SLUB_TINY
- bool "Randomize slab caches for normal kmalloc"
+ bool "Partitioned slab caches for normal kmalloc"
+ default RANDOM_KMALLOC_CACHES
help
- A hardening feature that creates multiple copies of slab caches for
- normal kmalloc allocation and makes kmalloc randomly pick one based
- on code address, which makes the attackers more difficult to spray
- vulnerable memory objects on the heap for the purpose of exploiting
- memory vulnerabilities.
+ A hardening feature that creates multiple isolated copies of slab
+ caches for normal kmalloc allocations. This makes it more difficult
+ to exploit memory-safety vulnerabilities by attacking vulnerable
+ co-located memory objects. Several modes are provided.
Currently the number of copies is set to 16, a reasonably large value
that effectively diverges the memory objects allocated for different
subsystems or modules into different caches, at the expense of a
- limited degree of memory and CPU overhead that relates to hardware and
- system workload.
+ limited degree of memory and CPU overhead that relates to hardware
+ and system workload.
+
+choice
+ prompt "Partitioned slab cache mode"
+ depends on KMALLOC_PARTITION_CACHES
+ default KMALLOC_PARTITION_TYPED if CC_HAS_ALLOC_TOKEN
+ default KMALLOC_PARTITION_RANDOM
+ help
+ Selects the slab cache partitioning mode.
+
+config KMALLOC_PARTITION_RANDOM
+ bool "Randomize slab caches for normal kmalloc"
+ help
+ Randomly pick a slab cache based on code address and a per-boot
+ random seed.
+
+ This makes it harder for attackers to predict object co-location.
+ The placement is random: while attackers don't know which kmalloc
+ cache an object will be allocated from, they might circumvent
+ the randomization by retrying attacks across multiple machines until
+ the target objects are co-located.
+
+config KMALLOC_PARTITION_TYPED
+ bool "Type based slab cache selection for normal kmalloc"
+ depends on CC_HAS_ALLOC_TOKEN
+ help
+ Rely on Clang's allocation tokens to choose a slab cache, where token
+ IDs are derived from the allocated type.
+
+ Unlike KMALLOC_PARTITION_RANDOM, cache assignment is deterministic based
+ on type, which guarantees that objects of certain types are not
+ placed in the same cache. This effectively mitigates certain classes
+ of exploits that probabilistic defenses like KMALLOC_PARTITION_RANDOM
+ only make harder but not impossible. However, this also means the
+ cache assignment is predictable.
+
+ Clang's default token ID calculation returns a bounded hash with
+ disjoint ranges for pointer-containing and pointerless objects: when
+ used as the slab cache index, this prevents buffer overflows on
+ primitive buffers from directly corrupting pointer-containing
+ objects.
+
+ The current effectiveness of Clang's type inference can be judged by
+ -Rpass=alloc-token, which provides diagnostics where (after dead-code
+ elimination) type inference failed.
+
+ Requires Clang 22 or later.
+
+endchoice
+
+config RANDOM_KMALLOC_CACHES
+ bool
+ transitional
+ help
+ Transitional config for migration to KMALLOC_PARTITION_CACHES.
endmenu # Slab allocator options
@@ -340,6 +390,7 @@ choice
config FLATMEM_MANUAL
bool "Flat Memory"
+ depends on !NUMA
depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
help
This option is best suited for non-NUMA systems with
@@ -374,6 +425,7 @@ config SPARSEMEM
config FLATMEM
def_bool y
+ depends on !NUMA
depends on !SPARSEMEM || FLATMEM_MANUAL
#
@@ -455,24 +507,14 @@ config EXCLUSIVE_SYSTEM_RAM
def_bool y
depends on !DEVMEM || STRICT_DEVMEM
-#
-# Only be set on architectures that have completely implemented memory hotplug
-# feature. If you are not sure, don't touch it.
-#
-config HAVE_BOOTMEM_INFO_NODE
- def_bool n
-
config ARCH_ENABLE_MEMORY_HOTPLUG
bool
-config ARCH_ENABLE_MEMORY_HOTREMOVE
- bool
-
# eventually, we can have this option just 'select SPARSEMEM'
menuconfig MEMORY_HOTPLUG
bool "Memory hotplug"
select MEMORY_ISOLATION
- depends on SPARSEMEM
+ depends on SPARSEMEM_VMEMMAP
depends on ARCH_ENABLE_MEMORY_HOTPLUG
depends on 64BIT
select NUMA_KEEP_MEMINFO if NUMA
@@ -539,13 +581,10 @@ endchoice
config MEMORY_HOTREMOVE
bool "Allow for memory hot remove"
- select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
- depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
- depends on MIGRATION
+ select MIGRATION
config MHP_MEMMAP_ON_MEMORY
def_bool y
- depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
endif # MEMORY_HOTPLUG
@@ -572,6 +611,7 @@ config SPLIT_PTE_PTLOCKS
depends on !ARM || CPU_CACHE_VIPT
depends on !PARISC || PA20
depends on !SPARC32
+ depends on !UML
config ARCH_ENABLE_SPLIT_PMD_PTLOCK
bool
@@ -630,20 +670,20 @@ config PAGE_REPORTING
those pages to another entity, such as a hypervisor, so that the
memory can be freed within the host for other uses.
-#
-# support for page migration
-#
-config MIGRATION
- bool "Page migration"
+config NUMA_MIGRATION
+ bool "NUMA page migration"
default y
- depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
+ depends on NUMA && MMU
+ select MIGRATION
help
- Allows the migration of the physical location of pages of processes
- while the virtual addresses are not changed. This is useful in
- two situations. The first is on NUMA systems to put pages nearer
- to the processors accessing. The second is when allocating huge
- pages as migration can relocate pages to satisfy a huge page
- allocation instead of reclaiming.
+ Support the migration of pages to other NUMA nodes, available to
+ user space through interfaces like migrate_pages(), move_pages(),
+ and mbind(). Selecting this option also enables support for page
+ demotion for memory tiering.
+
+config MIGRATION
+ bool
+ depends on MMU
config DEVICE_MIGRATION
def_bool MIGRATION && ZONE_DEVICE
@@ -651,7 +691,7 @@ config DEVICE_MIGRATION
config ARCH_ENABLE_HUGEPAGE_MIGRATION
bool
-config ARCH_ENABLE_THP_MIGRATION
+config ARCH_HAS_PMD_SOFTLEAVES
bool
config HUGETLB_PAGE_SIZE_VARIABLE
@@ -727,6 +767,7 @@ config MEMORY_FAILURE
depends on ARCH_SUPPORTS_MEMORY_FAILURE
bool "Enable recovery from hardware memory errors"
select INTERVAL_TREE
+ select MIGRATION
help
Enables code to recover from some memory failures on systems
with MCA recovery. This allows a system to continue running
@@ -811,7 +852,6 @@ if TRANSPARENT_HUGEPAGE
choice
prompt "Transparent Hugepage Support sysfs defaults"
- depends on TRANSPARENT_HUGEPAGE
default TRANSPARENT_HUGEPAGE_ALWAYS
help
Selects the sysfs defaults for Transparent Hugepage Support.
@@ -841,7 +881,6 @@ endchoice
choice
prompt "Shmem hugepage allocation defaults"
- depends on TRANSPARENT_HUGEPAGE
default TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER
help
Selects the hugepage allocation policy defaults for
@@ -887,7 +926,6 @@ endchoice
choice
prompt "Tmpfs hugepage allocation defaults"
- depends on TRANSPARENT_HUGEPAGE
default TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER
help
Selects the hugepage allocation policy defaults for
@@ -932,7 +970,7 @@ endchoice
config THP_SWAP
def_bool y
- depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
+ depends on ARCH_WANTS_THP_SWAP && SWAP && 64BIT
help
Swap transparent huge pages in one piece, without splitting.
XXX: For now, swap cluster backing transparent huge page
@@ -940,17 +978,6 @@ config THP_SWAP
For selection by architectures with reasonable THP sizes.
-config READ_ONLY_THP_FOR_FS
- bool "Read-only THP for filesystems (EXPERIMENTAL)"
- depends on TRANSPARENT_HUGEPAGE
-
- help
- Allow khugepaged to put read-only file-backed pages in THP.
-
- This is marked experimental because it is a new feature. Write
- support of file THPs will be developed in the next few release
- cycles.
-
config NO_PAGE_MAPCOUNT
bool "No per-page mapcount (EXPERIMENTAL)"
help
@@ -1197,9 +1224,7 @@ config ZONE_DMA32
config ZONE_DEVICE
bool "Device memory (pmem, HMM, etc...) hotplug support"
- depends on MEMORY_HOTPLUG
depends on MEMORY_HOTREMOVE
- depends on SPARSEMEM_VMEMMAP
select XARRAY_MULTI
help
@@ -1222,6 +1247,7 @@ config ZONE_DEVICE
config HMM_MIRROR
bool
depends on MMU
+ select MMU_NOTIFIER
config GET_FREE_REGION
bool
@@ -1304,7 +1330,7 @@ config ARCH_HAS_PTE_SPECIAL
bool
config MAPPING_DIRTY_HELPERS
- bool
+ bool
config KMAP_LOCAL
bool
@@ -1348,6 +1374,15 @@ config HAVE_ARCH_USERFAULTFD_MINOR
help
Arch has userfaultfd minor fault support
+config USERFAULTFD_RWP
+ def_bool y
+ depends on 64BIT && ARCH_HAS_PTE_PROTNONE && HAVE_ARCH_USERFAULTFD_WP
+ help
+ Userfaultfd read-write protection (UFFDIO_RWPROTECT) delivers a
+ userfaultfd notification on every access -- read or write -- to a
+ protected range, letting userspace observe the working set of a
+ process.
+
menuconfig USERFAULTFD
bool "Enable userfaultfd() system call"
depends on MMU
@@ -1355,17 +1390,15 @@ menuconfig USERFAULTFD
Enable the userfaultfd() system call that allows to intercept and
handle page faults in userland.
-if USERFAULTFD
config PTE_MARKER_UFFD_WP
bool "Userfaultfd write protection support for shmem/hugetlbfs"
default y
- depends on HAVE_ARCH_USERFAULTFD_WP
+ depends on USERFAULTFD && HAVE_ARCH_USERFAULTFD_WP
help
Allows to create marker PTEs for userfaultfd write protection
purposes. It is required to enable userfaultfd write protection on
file-backed memory types like shmem and hugetlbfs.
-endif # USERFAULTFD
# multi-gen LRU {
config LRU_GEN
@@ -1431,11 +1464,18 @@ config NUMA_EMU
into virtual nodes when booted with "numa=fake=N", where N is the
number of nodes. This is only useful for debugging.
+config GENERIC_ARCH_NUMA
+ bool
+ select NUMA_MEMBLKS
+ help
+ Enable support for generic NUMA implementation. Currently, RISC-V
+ and ARM64 use it.
+
config ARCH_HAS_USER_SHADOW_STACK
bool
help
The architecture has hardware support for userspace shadow call
- stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
+ stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
config HAVE_ARCH_TLB_REMOVE_TABLE
def_bool n