Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: GPL-2.0-only
0002 config PAGE_EXTENSION
0003         bool "Extend memmap on extra space for more information on page"
0004         help
0005           Extend memmap on extra space for more information on page. This
0006           could be used for debugging features that need to insert extra
0007           field for every page. This extension enables us to save memory
0008           by not allocating this extra memory according to boottime
0009           configuration.
0010 
0011 config DEBUG_PAGEALLOC
0012         bool "Debug page memory allocations"
0013         depends on DEBUG_KERNEL
0014         depends on !HIBERNATION || ARCH_SUPPORTS_DEBUG_PAGEALLOC && !PPC && !SPARC
0015         select PAGE_POISONING if !ARCH_SUPPORTS_DEBUG_PAGEALLOC
0016         help
0017           Unmap pages from the kernel linear mapping after free_pages().
0018           Depending on runtime enablement, this results in a small or large
0019           slowdown, but helps to find certain types of memory corruption.
0020 
0021           Also, the state of page tracking structures is checked more often as
0022           pages are being allocated and freed, as unexpected state changes
0023           often happen for same reasons as memory corruption (e.g. double free,
0024           use-after-free). The error reports for these checks can be augmented
0025           with stack traces of last allocation and freeing of the page, when
0026           PAGE_OWNER is also selected and enabled on boot.
0027 
0028           For architectures which don't enable ARCH_SUPPORTS_DEBUG_PAGEALLOC,
0029           fill the pages with poison patterns after free_pages() and verify
0030           the patterns before alloc_pages(). Additionally, this option cannot
0031           be enabled in combination with hibernation as that would result in
0032           incorrect warnings of memory corruption after a resume because free
0033           pages are not saved to the suspend image.
0034 
0035           By default this option will have a small overhead, e.g. by not
0036           allowing the kernel mapping to be backed by large pages on some
0037           architectures. Even bigger overhead comes when the debugging is
0038           enabled by DEBUG_PAGEALLOC_ENABLE_DEFAULT or the debug_pagealloc
0039           command line parameter.
0040 
0041 config DEBUG_PAGEALLOC_ENABLE_DEFAULT
0042         bool "Enable debug page memory allocations by default?"
0043         depends on DEBUG_PAGEALLOC
0044         help
0045           Enable debug page memory allocations by default? This value
0046           can be overridden by debug_pagealloc=off|on.
0047 
0048 config DEBUG_SLAB
0049         bool "Debug slab memory allocations"
0050         depends on DEBUG_KERNEL && SLAB
0051         help
0052           Say Y here to have the kernel do limited verification on memory
0053           allocation as well as poisoning memory on free to catch use of freed
0054           memory. This can make kmalloc/kfree-intensive workloads much slower.
0055 
0056 config SLUB_DEBUG
0057         default y
0058         bool "Enable SLUB debugging support" if EXPERT
0059         depends on SLUB && SYSFS
0060         select STACKDEPOT if STACKTRACE_SUPPORT
0061         help
0062           SLUB has extensive debug support features. Disabling these can
0063           result in significant savings in code size. This also disables
0064           SLUB sysfs support. /sys/slab will not exist and there will be
0065           no support for cache validation etc.
0066 
0067 config SLUB_DEBUG_ON
0068         bool "SLUB debugging on by default"
0069         depends on SLUB && SLUB_DEBUG
0070         select STACKDEPOT_ALWAYS_INIT if STACKTRACE_SUPPORT
0071         default n
0072         help
0073           Boot with debugging on by default. SLUB boots by default with
0074           the runtime debug capabilities switched off. Enabling this is
0075           equivalent to specifying the "slub_debug" parameter on boot.
0076           There is no support for more fine grained debug control like
0077           possible with slub_debug=xxx. SLUB debugging may be switched
0078           off in a kernel built with CONFIG_SLUB_DEBUG_ON by specifying
0079           "slub_debug=-".
0080 
0081 config PAGE_OWNER
0082         bool "Track page owner"
0083         depends on DEBUG_KERNEL && STACKTRACE_SUPPORT
0084         select DEBUG_FS
0085         select STACKTRACE
0086         select STACKDEPOT
0087         select PAGE_EXTENSION
0088         help
0089           This keeps track of what call chain is the owner of a page, may
0090           help to find bare alloc_page(s) leaks. Even if you include this
0091           feature on your build, it is disabled in default. You should pass
0092           "page_owner=on" to boot parameter in order to enable it. Eats
0093           a fair amount of memory if enabled. See tools/vm/page_owner_sort.c
0094           for user-space helper.
0095 
0096           If unsure, say N.
0097 
0098 config PAGE_TABLE_CHECK
0099         bool "Check for invalid mappings in user page tables"
0100         depends on ARCH_SUPPORTS_PAGE_TABLE_CHECK
0101         select PAGE_EXTENSION
0102         help
0103           Check that anonymous page is not being mapped twice with read write
0104           permissions. Check that anonymous and file pages are not being
0105           erroneously shared. Since the checking is performed at the time
0106           entries are added and removed to user page tables, leaking, corruption
0107           and double mapping problems are detected synchronously.
0108 
0109           If unsure say "n".
0110 
0111 config PAGE_TABLE_CHECK_ENFORCED
0112         bool "Enforce the page table checking by default"
0113         depends on PAGE_TABLE_CHECK
0114         help
0115           Always enable page table checking.  By default the page table checking
0116           is disabled, and can be optionally enabled via page_table_check=on
0117           kernel parameter. This config enforces that page table check is always
0118           enabled.
0119 
0120           If unsure say "n".
0121 
0122 config PAGE_POISONING
0123         bool "Poison pages after freeing"
0124         help
0125           Fill the pages with poison patterns after free_pages() and verify
0126           the patterns before alloc_pages. The filling of the memory helps
0127           reduce the risk of information leaks from freed data. This does
0128           have a potential performance impact if enabled with the
0129           "page_poison=1" kernel boot option.
0130 
0131           Note that "poison" here is not the same thing as the "HWPoison"
0132           for CONFIG_MEMORY_FAILURE. This is software poisoning only.
0133 
0134           If you are only interested in sanitization of freed pages without
0135           checking the poison pattern on alloc, you can boot the kernel with
0136           "init_on_free=1" instead of enabling this.
0137 
0138           If unsure, say N
0139 
0140 config DEBUG_PAGE_REF
0141         bool "Enable tracepoint to track down page reference manipulation"
0142         depends on DEBUG_KERNEL
0143         depends on TRACEPOINTS
0144         help
0145           This is a feature to add tracepoint for tracking down page reference
0146           manipulation. This tracking is useful to diagnose functional failure
0147           due to migration failures caused by page reference mismatches.  Be
0148           careful when enabling this feature because it adds about 30 KB to the
0149           kernel code.  However the runtime performance overhead is virtually
0150           nil until the tracepoints are actually enabled.
0151 
0152 config DEBUG_RODATA_TEST
0153     bool "Testcase for the marking rodata read-only"
0154     depends on STRICT_KERNEL_RWX
0155         help
0156       This option enables a testcase for the setting rodata read-only.
0157 
0158 config ARCH_HAS_DEBUG_WX
0159         bool
0160 
0161 config DEBUG_WX
0162         bool "Warn on W+X mappings at boot"
0163         depends on ARCH_HAS_DEBUG_WX
0164         depends on MMU
0165         select PTDUMP_CORE
0166         help
0167           Generate a warning if any W+X mappings are found at boot.
0168 
0169           This is useful for discovering cases where the kernel is leaving W+X
0170           mappings after applying NX, as such mappings are a security risk.
0171 
0172           Look for a message in dmesg output like this:
0173 
0174             <arch>/mm: Checked W+X mappings: passed, no W+X pages found.
0175 
0176           or like this, if the check failed:
0177 
0178             <arch>/mm: Checked W+X mappings: failed, <N> W+X pages found.
0179 
0180           Note that even if the check fails, your kernel is possibly
0181           still fine, as W+X mappings are not a security hole in
0182           themselves, what they do is that they make the exploitation
0183           of other unfixed kernel bugs easier.
0184 
0185           There is no runtime or memory usage effect of this option
0186           once the kernel has booted up - it's a one time check.
0187 
0188           If in doubt, say "Y".
0189 
0190 config GENERIC_PTDUMP
0191         bool
0192 
0193 config PTDUMP_CORE
0194         bool
0195 
0196 config PTDUMP_DEBUGFS
0197         bool "Export kernel pagetable layout to userspace via debugfs"
0198         depends on DEBUG_KERNEL
0199         depends on DEBUG_FS
0200         depends on GENERIC_PTDUMP
0201         select PTDUMP_CORE
0202         help
0203           Say Y here if you want to show the kernel pagetable layout in a
0204           debugfs file. This information is only useful for kernel developers
0205           who are working in architecture specific areas of the kernel.
0206           It is probably not a good idea to enable this feature in a production
0207           kernel.
0208 
0209           If in doubt, say N.