1# SPDX-License-Identifier: GPL-2.0 2# 3# General architecture dependent options 4# 5 6# 7# Note: arch/$(SRCARCH)/Kconfig needs to be included first so that it can 8# override the default values in this file. 9# 10source "arch/$(SRCARCH)/Kconfig" 11 12config ARCH_CONFIGURES_CPU_MITIGATIONS 13 bool 14 15if !ARCH_CONFIGURES_CPU_MITIGATIONS 16config CPU_MITIGATIONS 17 def_bool y 18endif 19 20# 21# Selected by architectures that need custom DMA operations for e.g. legacy 22# IOMMUs not handled by dma-iommu. Drivers must never select this symbol. 23# 24config ARCH_HAS_DMA_OPS 25 depends on HAS_DMA 26 select DMA_OPS_HELPERS 27 bool 28 29menu "General architecture-dependent options" 30 31config ARCH_HAS_SUBPAGE_FAULTS 32 bool 33 help 34 Select if the architecture can check permissions at sub-page 35 granularity (e.g. arm64 MTE). The probe_user_*() functions 36 must be implemented. 37 38config HOTPLUG_SMT 39 bool 40 41config SMT_NUM_THREADS_DYNAMIC 42 bool 43 44config ARCH_SUPPORTS_SCHED_SMT 45 bool 46 47config ARCH_SUPPORTS_SCHED_CLUSTER 48 bool 49 50config ARCH_SUPPORTS_SCHED_MC 51 bool 52 53config SCHED_SMT 54 bool "SMT (Hyperthreading) scheduler support" 55 depends on ARCH_SUPPORTS_SCHED_SMT 56 default y 57 help 58 Improves the CPU scheduler's decision making when dealing with 59 MultiThreading at a cost of slightly increased overhead in some 60 places. If unsure say N here. 61 62config SCHED_CLUSTER 63 bool "Cluster scheduler support" 64 depends on ARCH_SUPPORTS_SCHED_CLUSTER 65 default y 66 help 67 Cluster scheduler support improves the CPU scheduler's decision 68 making when dealing with machines that have clusters of CPUs. 69 Cluster usually means a couple of CPUs which are placed closely 70 by sharing mid-level caches, last-level cache tags or internal 71 busses. 72 73config SCHED_MC 74 bool "Multi-Core Cache (MC) scheduler support" 75 depends on ARCH_SUPPORTS_SCHED_MC 76 default y 77 help 78 Multi-core scheduler support improves the CPU scheduler's decision 79 making when dealing with multi-core CPU chips at a cost of slightly 80 increased overhead in some places. If unsure say N here. 81 82# Selected by HOTPLUG_CORE_SYNC_DEAD or HOTPLUG_CORE_SYNC_FULL 83config HOTPLUG_CORE_SYNC 84 bool 85 86# Basic CPU dead synchronization selected by architecture 87config HOTPLUG_CORE_SYNC_DEAD 88 bool 89 select HOTPLUG_CORE_SYNC 90 91# Full CPU synchronization with alive state selected by architecture 92config HOTPLUG_CORE_SYNC_FULL 93 bool 94 select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU 95 select HOTPLUG_CORE_SYNC 96 97config HOTPLUG_SPLIT_STARTUP 98 bool 99 select HOTPLUG_CORE_SYNC_FULL 100 101config HOTPLUG_PARALLEL 102 bool 103 select HOTPLUG_SPLIT_STARTUP 104 105config GENERIC_IRQ_ENTRY 106 bool 107 108config GENERIC_SYSCALL 109 bool 110 depends on GENERIC_IRQ_ENTRY 111 112config GENERIC_ENTRY 113 bool 114 select GENERIC_IRQ_ENTRY 115 select GENERIC_SYSCALL 116 117config SYSCALL_USER_DISPATCH 118 bool "Syscall User Dispatch" 119 depends on GENERIC_ENTRY 120 default y 121 help 122 Syscall User Dispatch lets a thread have its own system calls 123 intercepted and redirected to a userspace signal handler based 124 on a prctl() configured instruction pointer range. 125 If unsure, say Y. 126 127config KPROBES 128 bool "Kprobes" 129 depends on HAVE_KPROBES 130 select KALLSYMS 131 select EXECMEM 132 select NEED_TASKS_RCU 133 help 134 Kprobes allows you to trap at almost any kernel address and 135 execute a callback function. register_kprobe() establishes 136 a probepoint and specifies the callback. Kprobes is useful 137 for kernel debugging, non-intrusive instrumentation and testing. 138 If in doubt, say "N". 139 140config JUMP_LABEL 141 bool "Optimize very unlikely/likely branches" 142 depends on HAVE_ARCH_JUMP_LABEL 143 select OBJTOOL if HAVE_JUMP_LABEL_HACK 144 help 145 This option enables a transparent branch optimization that 146 makes certain almost-always-true or almost-always-false branch 147 conditions even cheaper to execute within the kernel. 148 149 Certain performance-sensitive kernel code, such as trace points, 150 scheduler functionality, networking code and KVM have such 151 branches and include support for this optimization technique. 152 153 If it is detected that the compiler has support for "asm goto", 154 the kernel will compile such branches with just a nop 155 instruction. When the condition flag is toggled to true, the 156 nop will be converted to a jump instruction to execute the 157 conditional block of instructions. 158 159 This technique lowers overhead and stress on the branch prediction 160 of the processor and generally makes the kernel faster. The update 161 of the condition is slower, but those are always very rare. 162 163 ( On 32-bit x86, the necessary options added to the compiler 164 flags may increase the size of the kernel slightly. ) 165 166config STATIC_KEYS_SELFTEST 167 bool "Static key selftest" 168 depends on JUMP_LABEL 169 help 170 Boot time self-test of the branch patching code. 171 172config STATIC_CALL_SELFTEST 173 bool "Static call selftest" 174 depends on HAVE_STATIC_CALL 175 help 176 Boot time self-test of the call patching code. 177 178config OPTPROBES 179 def_bool y 180 depends on KPROBES && HAVE_OPTPROBES 181 select NEED_TASKS_RCU 182 183config KPROBES_ON_FTRACE 184 def_bool y 185 depends on KPROBES && HAVE_KPROBES_ON_FTRACE 186 depends on DYNAMIC_FTRACE_WITH_REGS 187 help 188 If function tracer is enabled and the arch supports full 189 passing of pt_regs to function tracing, then kprobes can 190 optimize on top of function tracing. 191 192config UPROBES 193 def_bool n 194 depends on ARCH_SUPPORTS_UPROBES 195 select TASKS_TRACE_RCU 196 help 197 Uprobes is the user-space counterpart to kprobes: they 198 enable instrumentation applications (such as 'perf probe') 199 to establish unintrusive probes in user-space binaries and 200 libraries, by executing handler functions when the probes 201 are hit by user-space applications. 202 203 ( These probes come in the form of single-byte breakpoints, 204 managed by the kernel and kept transparent to the probed 205 application. ) 206 207config HAVE_64BIT_ALIGNED_ACCESS 208 def_bool 64BIT && !HAVE_EFFICIENT_UNALIGNED_ACCESS 209 help 210 Some architectures require 64 bit accesses to be 64 bit 211 aligned, which also requires structs containing 64 bit values 212 to be 64 bit aligned too. This includes some 32 bit 213 architectures which can do 64 bit accesses, as well as 64 bit 214 architectures without unaligned access. 215 216 This symbol should be selected by an architecture if 64 bit 217 accesses are required to be 64 bit aligned in this way even 218 though it is not a 64 bit architecture. 219 220 See Documentation/core-api/unaligned-memory-access.rst for 221 more information on the topic of unaligned memory accesses. 222 223config HAVE_EFFICIENT_UNALIGNED_ACCESS 224 bool 225 help 226 Some architectures are unable to perform unaligned accesses 227 without the use of get_unaligned/put_unaligned. Others are 228 unable to perform such accesses efficiently (e.g. trap on 229 unaligned access and require fixing it up in the exception 230 handler.) 231 232 This symbol should be selected by an architecture if it can 233 perform unaligned accesses efficiently to allow different 234 code paths to be selected for these cases. Some network 235 drivers, for example, could opt to not fix up alignment 236 problems with received packets if doing so would not help 237 much. 238 239 See Documentation/core-api/unaligned-memory-access.rst for more 240 information on the topic of unaligned memory accesses. 241 242config ARCH_USE_BUILTIN_BSWAP 243 bool 244 help 245 GCC and Clang have builtin functions for handling byte-swapping. 246 Using these allows the compiler to see what's happening and 247 offers more opportunity for optimisation. In particular, the 248 compiler will be able to combine the byteswap with a nearby load 249 or store and use load-and-swap or store-and-swap instructions if 250 the architecture has them. It should almost *never* result in code 251 which is worse than the hand-coded assembler in <asm/swab.h>. 252 But just in case it does, the use of the builtins is optional. 253 254 Any architecture with load-and-swap or store-and-swap 255 instructions should set this. And it shouldn't hurt to set it 256 on architectures that don't have such instructions. 257 258config KRETPROBES 259 def_bool y 260 depends on KPROBES && (HAVE_KRETPROBES || HAVE_RETHOOK) 261 262config KRETPROBE_ON_RETHOOK 263 def_bool y 264 depends on HAVE_RETHOOK 265 depends on KRETPROBES 266 select RETHOOK 267 268config USER_RETURN_NOTIFIER 269 bool 270 depends on HAVE_USER_RETURN_NOTIFIER 271 help 272 Provide a kernel-internal notification when a cpu is about to 273 switch to user mode. 274 275config HAVE_IOREMAP_PROT 276 bool 277 278config HAVE_KPROBES 279 bool 280 281config HAVE_KRETPROBES 282 bool 283 284config HAVE_OPTPROBES 285 bool 286 287config HAVE_KPROBES_ON_FTRACE 288 bool 289 290config ARCH_CORRECT_STACKTRACE_ON_KRETPROBE 291 bool 292 help 293 Since kretprobes modifies return address on the stack, the 294 stacktrace may see the kretprobe trampoline address instead 295 of correct one. If the architecture stacktrace code and 296 unwinder can adjust such entries, select this configuration. 297 298config HAVE_FUNCTION_ERROR_INJECTION 299 bool 300 301config HAVE_NMI 302 bool 303 304config HAVE_FUNCTION_DESCRIPTORS 305 bool 306 307config TRACE_IRQFLAGS_SUPPORT 308 bool 309 310config TRACE_IRQFLAGS_NMI_SUPPORT 311 bool 312 313# 314# An arch should select this if it provides all these things: 315# 316# task_pt_regs() in asm/processor.h or asm/ptrace.h 317# arch_has_single_step() if there is hardware single-step support 318# arch_has_block_step() if there is hardware block-step support 319# asm/syscall.h supplying asm-generic/syscall.h interface 320# linux/regset.h user_regset interfaces 321# CORE_DUMP_USE_REGSET #define'd in linux/elf.h 322# TIF_SYSCALL_TRACE calls ptrace_report_syscall_{entry,exit} 323# TIF_NOTIFY_RESUME calls resume_user_mode_work() 324# 325config HAVE_ARCH_TRACEHOOK 326 bool 327 328config HAVE_DMA_CONTIGUOUS 329 bool 330 331config GENERIC_SMP_IDLE_THREAD 332 bool 333 334config GENERIC_IDLE_POLL_SETUP 335 bool 336 337config ARCH_HAS_FORTIFY_SOURCE 338 bool 339 help 340 An architecture should select this when it can successfully 341 build and run with CONFIG_FORTIFY_SOURCE. 342 343# 344# Select if the arch provides a historic keepinit alias for the retain_initrd 345# command line option 346# 347config ARCH_HAS_KEEPINITRD 348 bool 349 350# Select if arch has all set_memory_ro/rw/x/nx() functions in asm/cacheflush.h 351config ARCH_HAS_SET_MEMORY 352 bool 353 354# Select if arch has all set_direct_map_invalid/default() functions 355config ARCH_HAS_SET_DIRECT_MAP 356 bool 357 358# 359# Select if the architecture provides the arch_dma_set_uncached symbol to 360# either provide an uncached segment alias for a DMA allocation, or 361# to remap the page tables in place. 362# 363config ARCH_HAS_DMA_SET_UNCACHED 364 bool 365 366# 367# Select if the architectures provides the arch_dma_clear_uncached symbol 368# to undo an in-place page table remap for uncached access. 369# 370config ARCH_HAS_DMA_CLEAR_UNCACHED 371 bool 372 373config ARCH_HAS_CPU_FINALIZE_INIT 374 bool 375 376# The architecture has a per-task state that includes the mm's PASID 377config ARCH_HAS_CPU_PASID 378 bool 379 select IOMMU_MM_DATA 380 381config HAVE_ARCH_THREAD_STRUCT_WHITELIST 382 bool 383 help 384 An architecture should select this to provide hardened usercopy 385 knowledge about what region of the thread_struct should be 386 whitelisted for copying to userspace. Normally this is only the 387 FPU registers. Specifically, arch_thread_struct_whitelist() 388 should be implemented. Without this, the entire thread_struct 389 field in task_struct will be left whitelisted. 390 391# Select if arch wants to size task_struct dynamically via arch_task_struct_size: 392config ARCH_WANTS_DYNAMIC_TASK_STRUCT 393 bool 394 395config ARCH_WANTS_NO_INSTR 396 bool 397 help 398 An architecture should select this if the noinstr macro is being used on 399 functions to denote that the toolchain should avoid instrumenting such 400 functions and is required for correctness. 401 402config ARCH_32BIT_OFF_T 403 bool 404 depends on !64BIT 405 help 406 All new 32-bit architectures should have 64-bit off_t type on 407 userspace side which corresponds to the loff_t kernel type. This 408 is the requirement for modern ABIs. Some existing architectures 409 still support 32-bit off_t. This option is enabled for all such 410 architectures explicitly. 411 412# Selected by 64 bit architectures which have a 32 bit f_tinode in struct ustat 413config ARCH_32BIT_USTAT_F_TINODE 414 bool 415 416# Selected by architectures with Total Store Order (TSO) 417config ARCH_MEMORY_ORDER_TSO 418 bool 419 420config HAVE_ASM_MODVERSIONS 421 bool 422 help 423 This symbol should be selected by an architecture if it provides 424 <asm/asm-prototypes.h> to support the module versioning for symbols 425 exported from assembly code. 426 427config HAVE_REGS_AND_STACK_ACCESS_API 428 bool 429 help 430 This symbol should be selected by an architecture if it supports 431 the API needed to access registers and stack entries from pt_regs, 432 declared in asm/ptrace.h 433 For example the kprobes-based event tracer needs this API. 434 435config HAVE_RSEQ 436 bool 437 depends on HAVE_REGS_AND_STACK_ACCESS_API 438 help 439 This symbol should be selected by an architecture if it 440 supports an implementation of restartable sequences. 441 442config HAVE_RUST 443 bool 444 help 445 This symbol should be selected by an architecture if it 446 supports Rust. 447 448config HAVE_FUNCTION_ARG_ACCESS_API 449 bool 450 help 451 This symbol should be selected by an architecture if it supports 452 the API needed to access function arguments from pt_regs, 453 declared in asm/ptrace.h 454 455config HAVE_HW_BREAKPOINT 456 bool 457 depends on PERF_EVENTS 458 459config HAVE_MIXED_BREAKPOINTS_REGS 460 bool 461 depends on HAVE_HW_BREAKPOINT 462 help 463 Depending on the arch implementation of hardware breakpoints, 464 some of them have separate registers for data and instruction 465 breakpoints addresses, others have mixed registers to store 466 them but define the access type in a control register. 467 Select this option if your arch implements breakpoints under the 468 latter fashion. 469 470config HAVE_USER_RETURN_NOTIFIER 471 bool 472 473config HAVE_PERF_EVENTS_NMI 474 bool 475 help 476 System hardware can generate an NMI using the perf event 477 subsystem. Also has support for calculating CPU cycle events 478 to determine how many clock cycles in a given period. 479 480config HAVE_HARDLOCKUP_DETECTOR_PERF 481 bool 482 depends on HAVE_PERF_EVENTS_NMI 483 help 484 The arch chooses to use the generic perf-NMI-based hardlockup 485 detector. Must define HAVE_PERF_EVENTS_NMI. 486 487config HAVE_HARDLOCKUP_DETECTOR_ARCH 488 bool 489 help 490 The arch provides its own hardlockup detector implementation instead 491 of the generic ones. 492 493 It uses the same command line parameters, and sysctl interface, 494 as the generic hardlockup detectors. 495 496config UNWIND_USER 497 bool 498 499config HAVE_UNWIND_USER_FP 500 bool 501 select UNWIND_USER 502 503config HAVE_PERF_REGS 504 bool 505 help 506 Support selective register dumps for perf events. This includes 507 bit-mapping of each registers and a unique architecture id. 508 509config HAVE_PERF_USER_STACK_DUMP 510 bool 511 help 512 Support user stack dumps for perf event samples. This needs 513 access to the user stack pointer which is not unified across 514 architectures. 515 516config HAVE_ARCH_JUMP_LABEL 517 bool 518 519config HAVE_ARCH_JUMP_LABEL_RELATIVE 520 bool 521 522config MMU_GATHER_TABLE_FREE 523 bool 524 525config MMU_GATHER_RCU_TABLE_FREE 526 bool 527 select MMU_GATHER_TABLE_FREE 528 529config MMU_GATHER_PAGE_SIZE 530 bool 531 532config MMU_GATHER_NO_RANGE 533 bool 534 select MMU_GATHER_MERGE_VMAS 535 536config MMU_GATHER_NO_FLUSH_CACHE 537 bool 538 539config MMU_GATHER_MERGE_VMAS 540 bool 541 542config MMU_GATHER_NO_GATHER 543 bool 544 depends on MMU_GATHER_TABLE_FREE 545 546config ARCH_WANT_IRQS_OFF_ACTIVATE_MM 547 bool 548 help 549 Temporary select until all architectures can be converted to have 550 irqs disabled over activate_mm. Architectures that do IPI based TLB 551 shootdowns should enable this. 552 553# Use normal mm refcounting for MMU_LAZY_TLB kernel thread references. 554# MMU_LAZY_TLB_REFCOUNT=n can improve the scalability of context switching 555# to/from kernel threads when the same mm is running on a lot of CPUs (a large 556# multi-threaded application), by reducing contention on the mm refcount. 557# 558# This can be disabled if the architecture ensures no CPUs are using an mm as a 559# "lazy tlb" beyond its final refcount (i.e., by the time __mmdrop frees the mm 560# or its kernel page tables). This could be arranged by arch_exit_mmap(), or 561# final exit(2) TLB flush, for example. 562# 563# To implement this, an arch *must*: 564# Ensure the _lazy_tlb variants of mmgrab/mmdrop are used when manipulating 565# the lazy tlb reference of a kthread's ->active_mm (non-arch code has been 566# converted already). 567config MMU_LAZY_TLB_REFCOUNT 568 def_bool y 569 depends on !MMU_LAZY_TLB_SHOOTDOWN 570 571# This option allows MMU_LAZY_TLB_REFCOUNT=n. It ensures no CPUs are using an 572# mm as a lazy tlb beyond its last reference count, by shooting down these 573# users before the mm is deallocated. __mmdrop() first IPIs all CPUs that may 574# be using the mm as a lazy tlb, so that they may switch themselves to using 575# init_mm for their active mm. mm_cpumask(mm) is used to determine which CPUs 576# may be using mm as a lazy tlb mm. 577# 578# To implement this, an arch *must*: 579# - At the time of the final mmdrop of the mm, ensure mm_cpumask(mm) contains 580# at least all possible CPUs in which the mm is lazy. 581# - It must meet the requirements for MMU_LAZY_TLB_REFCOUNT=n (see above). 582config MMU_LAZY_TLB_SHOOTDOWN 583 bool 584 585config ARCH_HAVE_NMI_SAFE_CMPXCHG 586 bool 587 588config ARCH_HAVE_EXTRA_ELF_NOTES 589 bool 590 help 591 An architecture should select this in order to enable adding an 592 arch-specific ELF note section to core files. It must provide two 593 functions: elf_coredump_extra_notes_size() and 594 elf_coredump_extra_notes_write() which are invoked by the ELF core 595 dumper. 596 597config ARCH_HAS_NMI_SAFE_THIS_CPU_OPS 598 bool 599 600config HAVE_ALIGNED_STRUCT_PAGE 601 bool 602 help 603 This makes sure that struct pages are double word aligned and that 604 e.g. the SLUB allocator can perform double word atomic operations 605 on a struct page for better performance. However selecting this 606 might increase the size of a struct page by a word. 607 608config HAVE_CMPXCHG_LOCAL 609 bool 610 611config HAVE_CMPXCHG_DOUBLE 612 bool 613 614config ARCH_WEAK_RELEASE_ACQUIRE 615 bool 616 617config ARCH_WANT_IPC_PARSE_VERSION 618 bool 619 620config ARCH_WANT_COMPAT_IPC_PARSE_VERSION 621 bool 622 623config ARCH_WANT_OLD_COMPAT_IPC 624 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION 625 bool 626 627config HAVE_ARCH_SECCOMP 628 bool 629 help 630 An arch should select this symbol to support seccomp mode 1 (the fixed 631 syscall policy), and must provide an overrides for __NR_seccomp_sigreturn, 632 and compat syscalls if the asm-generic/seccomp.h defaults need adjustment: 633 - __NR_seccomp_read_32 634 - __NR_seccomp_write_32 635 - __NR_seccomp_exit_32 636 - __NR_seccomp_sigreturn_32 637 638config HAVE_ARCH_SECCOMP_FILTER 639 bool 640 select HAVE_ARCH_SECCOMP 641 help 642 An arch should select this symbol if it provides all of these things: 643 - all the requirements for HAVE_ARCH_SECCOMP 644 - syscall_get_arch() 645 - syscall_get_arguments() 646 - syscall_rollback() 647 - syscall_set_return_value() 648 - SIGSYS siginfo_t support 649 - secure_computing is called from a ptrace_event()-safe context 650 - secure_computing return value is checked and a return value of -1 651 results in the system call being skipped immediately. 652 - seccomp syscall wired up 653 - if !HAVE_SPARSE_SYSCALL_NR, have SECCOMP_ARCH_NATIVE, 654 SECCOMP_ARCH_NATIVE_NR, SECCOMP_ARCH_NATIVE_NAME defined. If 655 COMPAT is supported, have the SECCOMP_ARCH_COMPAT* defines too. 656 657config SECCOMP 658 prompt "Enable seccomp to safely execute untrusted bytecode" 659 def_bool y 660 depends on HAVE_ARCH_SECCOMP 661 help 662 This kernel feature is useful for number crunching applications 663 that may need to handle untrusted bytecode during their 664 execution. By using pipes or other transports made available 665 to the process as file descriptors supporting the read/write 666 syscalls, it's possible to isolate those applications in their 667 own address space using seccomp. Once seccomp is enabled via 668 prctl(PR_SET_SECCOMP) or the seccomp() syscall, it cannot be 669 disabled and the task is only allowed to execute a few safe 670 syscalls defined by each seccomp mode. 671 672 If unsure, say Y. 673 674config SECCOMP_FILTER 675 def_bool y 676 depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET 677 help 678 Enable tasks to build secure computing environments defined 679 in terms of Berkeley Packet Filter programs which implement 680 task-defined system call filtering polices. 681 682 See Documentation/userspace-api/seccomp_filter.rst for details. 683 684config SECCOMP_CACHE_DEBUG 685 bool "Show seccomp filter cache status in /proc/pid/seccomp_cache" 686 depends on SECCOMP_FILTER && !HAVE_SPARSE_SYSCALL_NR 687 depends on PROC_FS 688 help 689 This enables the /proc/pid/seccomp_cache interface to monitor 690 seccomp cache data. The file format is subject to change. Reading 691 the file requires CAP_SYS_ADMIN. 692 693 This option is for debugging only. Enabling presents the risk that 694 an adversary may be able to infer the seccomp filter logic. 695 696 If unsure, say N. 697 698config HAVE_ARCH_KSTACK_ERASE 699 bool 700 help 701 An architecture should select this if it has the code which 702 fills the used part of the kernel stack with the KSTACK_ERASE_POISON 703 value before returning from system calls. 704 705config HAVE_STACKPROTECTOR 706 bool 707 help 708 An arch should select this symbol if: 709 - it has implemented a stack canary (e.g. __stack_chk_guard) 710 711config STACKPROTECTOR 712 bool "Stack Protector buffer overflow detection" 713 depends on HAVE_STACKPROTECTOR 714 depends on $(cc-option,-fstack-protector) 715 default y 716 help 717 This option turns on the "stack-protector" GCC feature. This 718 feature puts, at the beginning of functions, a canary value on 719 the stack just before the return address, and validates 720 the value just before actually returning. Stack based buffer 721 overflows (that need to overwrite this return address) now also 722 overwrite the canary, which gets detected and the attack is then 723 neutralized via a kernel panic. 724 725 Functions will have the stack-protector canary logic added if they 726 have an 8-byte or larger character array on the stack. 727 728 This feature requires gcc version 4.2 or above, or a distribution 729 gcc with the feature backported ("-fstack-protector"). 730 731 On an x86 "defconfig" build, this feature adds canary checks to 732 about 3% of all kernel functions, which increases kernel code size 733 by about 0.3%. 734 735config STACKPROTECTOR_STRONG 736 bool "Strong Stack Protector" 737 depends on STACKPROTECTOR 738 depends on $(cc-option,-fstack-protector-strong) 739 default y 740 help 741 Functions will have the stack-protector canary logic added in any 742 of the following conditions: 743 744 - local variable's address used as part of the right hand side of an 745 assignment or function argument 746 - local variable is an array (or union containing an array), 747 regardless of array type or length 748 - uses register local variables 749 750 This feature requires gcc version 4.9 or above, or a distribution 751 gcc with the feature backported ("-fstack-protector-strong"). 752 753 On an x86 "defconfig" build, this feature adds canary checks to 754 about 20% of all kernel functions, which increases the kernel code 755 size by about 2%. 756 757config ARCH_SUPPORTS_SHADOW_CALL_STACK 758 bool 759 help 760 An architecture should select this if it supports the compiler's 761 Shadow Call Stack and implements runtime support for shadow stack 762 switching. 763 764config SHADOW_CALL_STACK 765 bool "Shadow Call Stack" 766 depends on ARCH_SUPPORTS_SHADOW_CALL_STACK 767 depends on DYNAMIC_FTRACE_WITH_ARGS || DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER 768 depends on MMU 769 help 770 This option enables the compiler's Shadow Call Stack, which 771 uses a shadow stack to protect function return addresses from 772 being overwritten by an attacker. More information can be found 773 in the compiler's documentation: 774 775 - Clang: https://clang.llvm.org/docs/ShadowCallStack.html 776 - GCC: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#Instrumentation-Options 777 778 Note that security guarantees in the kernel differ from the 779 ones documented for user space. The kernel must store addresses 780 of shadow stacks in memory, which means an attacker capable of 781 reading and writing arbitrary memory may be able to locate them 782 and hijack control flow by modifying the stacks. 783 784config DYNAMIC_SCS 785 bool 786 help 787 Set by the arch code if it relies on code patching to insert the 788 shadow call stack push and pop instructions rather than on the 789 compiler. 790 791config LTO 792 bool 793 help 794 Selected if the kernel will be built using the compiler's LTO feature. 795 796config LTO_CLANG 797 bool 798 select LTO 799 help 800 Selected if the kernel will be built using Clang's LTO feature. 801 802config ARCH_SUPPORTS_LTO_CLANG 803 bool 804 help 805 An architecture should select this option if it supports: 806 - compiling with Clang, 807 - compiling inline assembly with Clang's integrated assembler, 808 - and linking with LLD. 809 810config ARCH_SUPPORTS_LTO_CLANG_THIN 811 bool 812 help 813 An architecture should select this option if it can support Clang's 814 ThinLTO mode. 815 816config HAS_LTO_CLANG 817 def_bool y 818 depends on CC_IS_CLANG && LD_IS_LLD && AS_IS_LLVM 819 depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm) 820 depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm) 821 depends on ARCH_SUPPORTS_LTO_CLANG 822 depends on !FTRACE_MCOUNT_USE_RECORDMCOUNT 823 depends on !GCOV_KERNEL 824 help 825 The compiler and Kconfig options support building with Clang's 826 LTO. 827 828choice 829 prompt "Link Time Optimization (LTO)" 830 default LTO_NONE 831 help 832 This option enables Link Time Optimization (LTO), which allows the 833 compiler to optimize binaries globally. 834 835 If unsure, select LTO_NONE. Note that LTO is very resource-intensive 836 so it's disabled by default. 837 838config LTO_NONE 839 bool "None" 840 help 841 Build the kernel normally, without Link Time Optimization (LTO). 842 843config LTO_CLANG_FULL 844 bool "Clang Full LTO (EXPERIMENTAL)" 845 depends on HAS_LTO_CLANG 846 depends on !COMPILE_TEST 847 select LTO_CLANG 848 help 849 This option enables Clang's full Link Time Optimization (LTO), which 850 allows the compiler to optimize the kernel globally. If you enable 851 this option, the compiler generates LLVM bitcode instead of ELF 852 object files, and the actual compilation from bitcode happens at 853 the LTO link step, which may take several minutes depending on the 854 kernel configuration. More information can be found from LLVM's 855 documentation: 856 857 https://llvm.org/docs/LinkTimeOptimization.html 858 859 During link time, this option can use a large amount of RAM, and 860 may take much longer than the ThinLTO option. 861 862config LTO_CLANG_THIN 863 bool "Clang ThinLTO (EXPERIMENTAL)" 864 depends on HAS_LTO_CLANG && ARCH_SUPPORTS_LTO_CLANG_THIN 865 select LTO_CLANG 866 help 867 This option enables Clang's ThinLTO, which allows for parallel 868 optimization and faster incremental compiles compared to the 869 CONFIG_LTO_CLANG_FULL option. More information can be found 870 from Clang's documentation: 871 872 https://clang.llvm.org/docs/ThinLTO.html 873 874 If unsure, say Y. 875 876config LTO_CLANG_THIN_DIST 877 bool "Clang ThinLTO in distributed mode (EXPERIMENTAL)" 878 depends on HAS_LTO_CLANG && ARCH_SUPPORTS_LTO_CLANG_THIN 879 select LTO_CLANG 880 help 881 This option enables Clang's ThinLTO in distributed build mode. 882 In this mode, the linker performs the thin-link, generating 883 ThinLTO index files. Subsequently, the build system explicitly 884 invokes ThinLTO backend compilation using these index files 885 and pre-linked IR objects. The resulting native object files 886 are with the .thinlto-native.o suffix. 887 888 This build mode offers improved visibility into the ThinLTO 889 process through explicit subcommand exposure. It also makes 890 final native object files directly available, benefiting 891 tools like objtool and kpatch. Additionally, it provides 892 crucial granular control over back-end options, enabling 893 module-specific compiler options, and simplifies debugging. 894endchoice 895 896config AUTOFDO_CLANG 897 bool "Enable Clang's AutoFDO build (EXPERIMENTAL)" 898 depends on CC_IS_CLANG 899 help 900 This option enables Clang’s AutoFDO build. When 901 an AutoFDO profile is specified in variable 902 CLANG_AUTOFDO_PROFILE during the build process, 903 Clang uses the profile to optimize the kernel. 904 905 If no profile is specified, AutoFDO options are 906 still passed to Clang to facilitate the collection 907 of perf data for creating an AutoFDO profile in 908 subsequent builds. 909 910 If unsure, say N. 911 912config PROPELLER_CLANG 913 bool "Enable Clang's Propeller build" 914 depends on CC_IS_CLANG && CLANG_VERSION >= 190000 915 depends on $(cc-option,-fbasic-block-sections=list=/dev/null) 916 help 917 This option enables Clang’s Propeller build. When the Propeller 918 profiles is specified in variable CLANG_PROPELLER_PROFILE_PREFIX 919 during the build process, Clang uses the profiles to optimize 920 the kernel. 921 922 If no profile is specified, Propeller options are still passed 923 to Clang to facilitate the collection of perf data for creating 924 the Propeller profiles in subsequent builds. 925 926 If unsure, say N. 927 928config ARCH_SUPPORTS_CFI 929 bool 930 help 931 An architecture should select this option if it can support Kernel 932 Control-Flow Integrity (CFI) checking (-fsanitize=kcfi). 933 934config ARCH_USES_CFI_TRAPS 935 bool 936 help 937 An architecture should select this option if it requires the 938 .kcfi_traps section for KCFI trap handling. 939 940config ARCH_USES_CFI_GENERIC_LLVM_PASS 941 bool 942 help 943 An architecture should select this option if it uses the generic 944 KCFIPass in LLVM to expand kCFI bundles instead of architecture-specific 945 lowering. 946 947config CFI 948 bool "Use Kernel Control Flow Integrity (kCFI)" 949 default CFI_CLANG 950 depends on ARCH_SUPPORTS_CFI 951 depends on $(cc-option,-fsanitize=kcfi) 952 help 953 This option enables forward-edge Control Flow Integrity (CFI) 954 checking, where the compiler injects a runtime check to each 955 indirect function call to ensure the target is a valid function with 956 the correct static type. This restricts possible call targets and 957 makes it more difficult for an attacker to exploit bugs that allow 958 the modification of stored function pointers. More information can be 959 found from Clang's documentation: 960 961 https://clang.llvm.org/docs/ControlFlowIntegrity.html 962 963config CFI_CLANG 964 bool 965 transitional 966 help 967 Transitional config for CFI_CLANG to CFI migration. 968 969config CFI_ICALL_NORMALIZE_INTEGERS 970 bool "Normalize CFI tags for integers" 971 depends on CFI 972 depends on HAVE_CFI_ICALL_NORMALIZE_INTEGERS 973 help 974 This option normalizes the CFI tags for integer types so that all 975 integer types of the same size and signedness receive the same CFI 976 tag. 977 978 The option is separate from CONFIG_RUST because it affects the ABI. 979 When working with build systems that care about the ABI, it is 980 convenient to be able to turn on this flag first, before Rust is 981 turned on. 982 983 This option is necessary for using CFI with Rust. If unsure, say N. 984 985config HAVE_CFI_ICALL_NORMALIZE_INTEGERS 986 def_bool y 987 depends on $(cc-option,-fsanitize=kcfi -fsanitize-cfi-icall-experimental-normalize-integers) 988 # With GCOV/KASAN we need this fix: https://github.com/llvm/llvm-project/pull/104826 989 depends on CLANG_VERSION >= 190103 || (!GCOV_KERNEL && !KASAN_GENERIC && !KASAN_SW_TAGS) 990 991config HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC 992 def_bool y 993 depends on HAVE_CFI_ICALL_NORMALIZE_INTEGERS 994 depends on ARM64 || X86_64 995 # With GCOV/KASAN we need this fix: https://github.com/rust-lang/rust/pull/129373 996 depends on RUSTC_LLVM_VERSION >= 190103 || \ 997 (!GCOV_KERNEL && !KASAN_GENERIC && !KASAN_SW_TAGS) 998 999config CFI_PERMISSIVE 1000 bool "Use CFI in permissive mode" 1001 depends on CFI 1002 help 1003 When selected, Control Flow Integrity (CFI) violations result in a 1004 warning instead of a kernel panic. This option should only be used 1005 for finding indirect call type mismatches during development. 1006 1007 If unsure, say N. 1008 1009config HAVE_ARCH_WITHIN_STACK_FRAMES 1010 bool 1011 help 1012 An architecture should select this if it can walk the kernel stack 1013 frames to determine if an object is part of either the arguments 1014 or local variables (i.e. that it excludes saved return addresses, 1015 and similar) by implementing an inline arch_within_stack_frames(), 1016 which is used by CONFIG_HARDENED_USERCOPY. 1017 1018config HAVE_CONTEXT_TRACKING_USER 1019 bool 1020 help 1021 Provide kernel/user boundaries probes necessary for subsystems 1022 that need it, such as userspace RCU extended quiescent state. 1023 Syscalls need to be wrapped inside user_exit()-user_enter(), either 1024 optimized behind static key or through the slow path using TIF_NOHZ 1025 flag. Exceptions handlers must be wrapped as well. Irqs are already 1026 protected inside ct_irq_enter/ct_irq_exit() but preemption or signal 1027 handling on irq exit still need to be protected. 1028 1029config HAVE_CONTEXT_TRACKING_USER_OFFSTACK 1030 bool 1031 help 1032 Architecture neither relies on exception_enter()/exception_exit() 1033 nor on schedule_user(). Also preempt_schedule_notrace() and 1034 preempt_schedule_irq() can't be called in a preemptible section 1035 while context tracking is CT_STATE_USER. This feature reflects a sane 1036 entry implementation where the following requirements are met on 1037 critical entry code, ie: before user_exit() or after user_enter(): 1038 1039 - Critical entry code isn't preemptible (or better yet: 1040 not interruptible). 1041 - No use of RCU read side critical sections, unless ct_nmi_enter() 1042 got called. 1043 - No use of instrumentation, unless instrumentation_begin() got 1044 called. 1045 1046config HAVE_TIF_NOHZ 1047 bool 1048 help 1049 Arch relies on TIF_NOHZ and syscall slow path to implement context 1050 tracking calls to user_enter()/user_exit(). 1051 1052config HAVE_VIRT_CPU_ACCOUNTING 1053 bool 1054 1055config HAVE_VIRT_CPU_ACCOUNTING_IDLE 1056 bool 1057 help 1058 Architecture has its own way to account idle CPU time and therefore 1059 doesn't implement vtime_account_idle(). 1060 1061config ARCH_HAS_SCALED_CPUTIME 1062 bool 1063 1064config HAVE_VIRT_CPU_ACCOUNTING_GEN 1065 bool 1066 default y if 64BIT 1067 help 1068 With VIRT_CPU_ACCOUNTING_GEN, cputime_t becomes 64-bit. 1069 Before enabling this option, arch code must be audited 1070 to ensure there are no races in concurrent read/write of 1071 cputime_t. For example, reading/writing 64-bit cputime_t on 1072 some 32-bit arches may require multiple accesses, so proper 1073 locking is needed to protect against concurrent accesses. 1074 1075config HAVE_IRQ_TIME_ACCOUNTING 1076 bool 1077 help 1078 Archs need to ensure they use a high enough resolution clock to 1079 support irq time accounting and then call enable_sched_clock_irqtime(). 1080 1081config HAVE_PV_STEAL_CLOCK_GEN 1082 bool 1083 1084config HAVE_MOVE_PUD 1085 bool 1086 help 1087 Architectures that select this are able to move page tables at the 1088 PUD level. If there are only 3 page table levels, the move effectively 1089 happens at the PGD level. 1090 1091config HAVE_MOVE_PMD 1092 bool 1093 help 1094 Archs that select this are able to move page tables at the PMD level. 1095 1096config HAVE_ARCH_TRANSPARENT_HUGEPAGE 1097 bool 1098 1099config HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD 1100 bool 1101 1102config HAVE_ARCH_HUGE_VMAP 1103 bool 1104 1105# 1106# Archs that select this would be capable of PMD-sized vmaps (i.e., 1107# arch_vmap_pmd_supported() returns true). The VM_ALLOW_HUGE_VMAP flag 1108# must be used to enable allocations to use hugepages. 1109# 1110config HAVE_ARCH_HUGE_VMALLOC 1111 depends on HAVE_ARCH_HUGE_VMAP 1112 bool 1113 1114config ARCH_WANT_HUGE_PMD_SHARE 1115 bool 1116 1117# Archs that want to use pmd_mkwrite on kernel memory need it defined even 1118# if there are no userspace memory management features that use it 1119config ARCH_WANT_KERNEL_PMD_MKWRITE 1120 bool 1121 1122config ARCH_WANT_PMD_MKWRITE 1123 def_bool TRANSPARENT_HUGEPAGE || ARCH_WANT_KERNEL_PMD_MKWRITE 1124 1125config HAVE_ARCH_SOFT_DIRTY 1126 bool 1127 1128config HAVE_MOD_ARCH_SPECIFIC 1129 bool 1130 help 1131 The arch uses struct mod_arch_specific to store data. Many arches 1132 just need a simple module loader without arch specific data - those 1133 should not enable this. 1134 1135config MODULES_USE_ELF_RELA 1136 bool 1137 help 1138 Modules only use ELF RELA relocations. Modules with ELF REL 1139 relocations will give an error. 1140 1141config MODULES_USE_ELF_REL 1142 bool 1143 help 1144 Modules only use ELF REL relocations. Modules with ELF RELA 1145 relocations will give an error. 1146 1147config ARCH_WANTS_MODULES_DATA_IN_VMALLOC 1148 bool 1149 help 1150 For architectures like powerpc/32 which have constraints on module 1151 allocation and need to allocate module data outside of module area. 1152 1153config ARCH_WANTS_MODULES_TEXT_SECTIONS 1154 bool 1155 help 1156 For architectures like 32-bit parisc which require that functions in 1157 modules have to keep code in own text sections (-ffunction-sections) 1158 and to avoid merging all text into one big text section, 1159 1160config ARCH_WANTS_EXECMEM_LATE 1161 bool 1162 help 1163 For architectures that do not allocate executable memory early on 1164 boot, but rather require its initialization late when there is 1165 enough entropy for module space randomization, for instance 1166 arm64. 1167 1168config ARCH_HAS_EXECMEM_ROX 1169 bool 1170 depends on MMU && !HIGHMEM 1171 help 1172 For architectures that support allocations of executable memory 1173 with read-only execute permissions. Architecture must implement 1174 execmem_fill_trapping_insns() callback to enable this. 1175 1176config HAVE_IRQ_EXIT_ON_IRQ_STACK 1177 bool 1178 help 1179 Architecture doesn't only execute the irq handler on the irq stack 1180 but also irq_exit(). This way we can process softirqs on this irq 1181 stack instead of switching to a new one when we call __do_softirq() 1182 in the end of an hardirq. 1183 This spares a stack switch and improves cache usage on softirq 1184 processing. 1185 1186config HAVE_SOFTIRQ_ON_OWN_STACK 1187 bool 1188 help 1189 Architecture provides a function to run __do_softirq() on a 1190 separate stack. 1191 1192config SOFTIRQ_ON_OWN_STACK 1193 def_bool HAVE_SOFTIRQ_ON_OWN_STACK && !PREEMPT_RT 1194 1195config ALTERNATE_USER_ADDRESS_SPACE 1196 bool 1197 help 1198 Architectures set this when the CPU uses separate address 1199 spaces for kernel and user space pointers. In this case, the 1200 access_ok() check on a __user pointer is skipped. 1201 1202config PGTABLE_LEVELS 1203 int 1204 default 2 1205 1206config ARCH_HAS_ELF_RANDOMIZE 1207 bool 1208 help 1209 An architecture supports choosing randomized locations for 1210 stack, mmap, brk, and ET_DYN. Defined functions: 1211 - arch_mmap_rnd() 1212 - arch_randomize_brk() 1213 1214config HAVE_ARCH_MMAP_RND_BITS 1215 bool 1216 help 1217 An arch should select this symbol if it supports setting a variable 1218 number of bits for use in establishing the base address for mmap 1219 allocations, has MMU enabled and provides values for both: 1220 - ARCH_MMAP_RND_BITS_MIN 1221 - ARCH_MMAP_RND_BITS_MAX 1222 1223config HAVE_EXIT_THREAD 1224 bool 1225 help 1226 An architecture implements exit_thread. 1227 1228config ARCH_MMAP_RND_BITS_MIN 1229 int 1230 1231config ARCH_MMAP_RND_BITS_MAX 1232 int 1233 1234config ARCH_MMAP_RND_BITS_DEFAULT 1235 int 1236 1237config ARCH_MMAP_RND_BITS 1238 int "Number of bits to use for ASLR of mmap base address" if EXPERT 1239 range ARCH_MMAP_RND_BITS_MIN ARCH_MMAP_RND_BITS_MAX 1240 default ARCH_MMAP_RND_BITS_DEFAULT if ARCH_MMAP_RND_BITS_DEFAULT 1241 default ARCH_MMAP_RND_BITS_MIN 1242 depends on HAVE_ARCH_MMAP_RND_BITS 1243 help 1244 This value can be used to select the number of bits to use to 1245 determine the random offset to the base address of vma regions 1246 resulting from mmap allocations. This value will be bounded 1247 by the architecture's minimum and maximum supported values. 1248 1249 This value can be changed after boot using the 1250 /proc/sys/vm/mmap_rnd_bits tunable 1251 1252config HAVE_ARCH_MMAP_RND_COMPAT_BITS 1253 bool 1254 help 1255 An arch should select this symbol if it supports running applications 1256 in compatibility mode, supports setting a variable number of bits for 1257 use in establishing the base address for mmap allocations, has MMU 1258 enabled and provides values for both: 1259 - ARCH_MMAP_RND_COMPAT_BITS_MIN 1260 - ARCH_MMAP_RND_COMPAT_BITS_MAX 1261 1262config ARCH_MMAP_RND_COMPAT_BITS_MIN 1263 int 1264 1265config ARCH_MMAP_RND_COMPAT_BITS_MAX 1266 int 1267 1268config ARCH_MMAP_RND_COMPAT_BITS_DEFAULT 1269 int 1270 1271config ARCH_MMAP_RND_COMPAT_BITS 1272 int "Number of bits to use for ASLR of mmap base address for compatible applications" if EXPERT 1273 range ARCH_MMAP_RND_COMPAT_BITS_MIN ARCH_MMAP_RND_COMPAT_BITS_MAX 1274 default ARCH_MMAP_RND_COMPAT_BITS_DEFAULT if ARCH_MMAP_RND_COMPAT_BITS_DEFAULT 1275 default ARCH_MMAP_RND_COMPAT_BITS_MIN 1276 depends on HAVE_ARCH_MMAP_RND_COMPAT_BITS 1277 help 1278 This value can be used to select the number of bits to use to 1279 determine the random offset to the base address of vma regions 1280 resulting from mmap allocations for compatible applications This 1281 value will be bounded by the architecture's minimum and maximum 1282 supported values. 1283 1284 This value can be changed after boot using the 1285 /proc/sys/vm/mmap_rnd_compat_bits tunable 1286 1287config HAVE_ARCH_COMPAT_MMAP_BASES 1288 bool 1289 help 1290 This allows 64bit applications to invoke 32-bit mmap() syscall 1291 and vice-versa 32-bit applications to call 64-bit mmap(). 1292 Required for applications doing different bitness syscalls. 1293 1294config HAVE_PAGE_SIZE_4KB 1295 bool 1296 1297config HAVE_PAGE_SIZE_8KB 1298 bool 1299 1300config HAVE_PAGE_SIZE_16KB 1301 bool 1302 1303config HAVE_PAGE_SIZE_32KB 1304 bool 1305 1306config HAVE_PAGE_SIZE_64KB 1307 bool 1308 1309config HAVE_PAGE_SIZE_256KB 1310 bool 1311 1312choice 1313 prompt "MMU page size" 1314 1315config PAGE_SIZE_4KB 1316 bool "4KiB pages" 1317 depends on HAVE_PAGE_SIZE_4KB 1318 help 1319 This option select the standard 4KiB Linux page size and the only 1320 available option on many architectures. Using 4KiB page size will 1321 minimize memory consumption and is therefore recommended for low 1322 memory systems. 1323 Some software that is written for x86 systems makes incorrect 1324 assumptions about the page size and only runs on 4KiB pages. 1325 1326config PAGE_SIZE_8KB 1327 bool "8KiB pages" 1328 depends on HAVE_PAGE_SIZE_8KB 1329 help 1330 This option is the only supported page size on a few older 1331 processors, and can be slightly faster than 4KiB pages. 1332 1333config PAGE_SIZE_16KB 1334 bool "16KiB pages" 1335 depends on HAVE_PAGE_SIZE_16KB 1336 help 1337 This option is usually a good compromise between memory 1338 consumption and performance for typical desktop and server 1339 workloads, often saving a level of page table lookups compared 1340 to 4KB pages as well as reducing TLB pressure and overhead of 1341 per-page operations in the kernel at the expense of a larger 1342 page cache. 1343 1344config PAGE_SIZE_32KB 1345 bool "32KiB pages" 1346 depends on HAVE_PAGE_SIZE_32KB 1347 help 1348 Using 32KiB page size will result in slightly higher performance 1349 kernel at the price of higher memory consumption compared to 1350 16KiB pages. This option is available only on cnMIPS cores. 1351 Note that you will need a suitable Linux distribution to 1352 support this. 1353 1354config PAGE_SIZE_64KB 1355 bool "64KiB pages" 1356 depends on HAVE_PAGE_SIZE_64KB 1357 help 1358 Using 64KiB page size will result in slightly higher performance 1359 kernel at the price of much higher memory consumption compared to 1360 4KiB or 16KiB pages. 1361 This is not suitable for general-purpose workloads but the 1362 better performance may be worth the cost for certain types of 1363 supercomputing or database applications that work mostly with 1364 large in-memory data rather than small files. 1365 1366config PAGE_SIZE_256KB 1367 bool "256KiB pages" 1368 depends on HAVE_PAGE_SIZE_256KB 1369 help 1370 256KiB pages have little practical value due to their extreme 1371 memory usage. The kernel will only be able to run applications 1372 that have been compiled with '-zmax-page-size' set to 256KiB 1373 (the default is 64KiB or 4KiB on most architectures). 1374 1375endchoice 1376 1377config PAGE_SIZE_LESS_THAN_64KB 1378 def_bool y 1379 depends on !PAGE_SIZE_64KB 1380 depends on PAGE_SIZE_LESS_THAN_256KB 1381 1382config PAGE_SIZE_LESS_THAN_256KB 1383 def_bool y 1384 depends on !PAGE_SIZE_256KB 1385 1386config PAGE_SHIFT 1387 int 1388 default 12 if PAGE_SIZE_4KB 1389 default 13 if PAGE_SIZE_8KB 1390 default 14 if PAGE_SIZE_16KB 1391 default 15 if PAGE_SIZE_32KB 1392 default 16 if PAGE_SIZE_64KB 1393 default 18 if PAGE_SIZE_256KB 1394 1395# This allows to use a set of generic functions to determine mmap base 1396# address by giving priority to top-down scheme only if the process 1397# is not in legacy mode (compat task, unlimited stack size or 1398# sysctl_legacy_va_layout). 1399# Architecture that selects this option can provide its own version of: 1400# - STACK_RND_MASK 1401config ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT 1402 bool 1403 depends on MMU 1404 select ARCH_HAS_ELF_RANDOMIZE 1405 1406config HAVE_OBJTOOL 1407 bool 1408 1409config HAVE_JUMP_LABEL_HACK 1410 bool 1411 1412config HAVE_NOINSTR_HACK 1413 bool 1414 1415config HAVE_NOINSTR_VALIDATION 1416 bool 1417 1418config HAVE_UACCESS_VALIDATION 1419 bool 1420 select OBJTOOL 1421 1422config HAVE_STACK_VALIDATION 1423 bool 1424 help 1425 Architecture supports objtool compile-time frame pointer rule 1426 validation. 1427 1428config HAVE_RELIABLE_STACKTRACE 1429 bool 1430 help 1431 Architecture has either save_stack_trace_tsk_reliable() or 1432 arch_stack_walk_reliable() function which only returns a stack trace 1433 if it can guarantee the trace is reliable. 1434 1435config HAVE_ARCH_HASH 1436 bool 1437 default n 1438 help 1439 If this is set, the architecture provides an <asm/hash.h> 1440 file which provides platform-specific implementations of some 1441 functions in <linux/hash.h> or fs/namei.c. 1442 1443config HAVE_ARCH_NVRAM_OPS 1444 bool 1445 1446config ISA_BUS_API 1447 def_bool ISA 1448 1449# 1450# ABI hall of shame 1451# 1452config CLONE_BACKWARDS 1453 bool 1454 help 1455 Architecture has tls passed as the 4th argument of clone(2), 1456 not the 5th one. 1457 1458config CLONE_BACKWARDS2 1459 bool 1460 help 1461 Architecture has the first two arguments of clone(2) swapped. 1462 1463config CLONE_BACKWARDS3 1464 bool 1465 help 1466 Architecture has tls passed as the 3rd argument of clone(2), 1467 not the 5th one. 1468 1469config ODD_RT_SIGACTION 1470 bool 1471 help 1472 Architecture has unusual rt_sigaction(2) arguments 1473 1474config OLD_SIGSUSPEND 1475 bool 1476 help 1477 Architecture has old sigsuspend(2) syscall, of one-argument variety 1478 1479config OLD_SIGSUSPEND3 1480 bool 1481 help 1482 Even weirder antique ABI - three-argument sigsuspend(2) 1483 1484config OLD_SIGACTION 1485 bool 1486 help 1487 Architecture has old sigaction(2) syscall. Nope, not the same 1488 as OLD_SIGSUSPEND | OLD_SIGSUSPEND3 - alpha has sigsuspend(2), 1489 but fairly different variant of sigaction(2), thanks to OSF/1 1490 compatibility... 1491 1492config COMPAT_OLD_SIGACTION 1493 bool 1494 1495config COMPAT_32BIT_TIME 1496 bool "Provide system calls for 32-bit time_t" 1497 default !64BIT || COMPAT 1498 help 1499 This enables 32 bit time_t support in addition to 64 bit time_t support. 1500 This is relevant on all 32-bit architectures, and 64-bit architectures 1501 as part of compat syscall handling. 1502 1503config ARCH_NO_PREEMPT 1504 bool 1505 1506config ARCH_SUPPORTS_RT 1507 bool 1508 1509config CPU_NO_EFFICIENT_FFS 1510 def_bool n 1511 1512config HAVE_ARCH_VMAP_STACK 1513 def_bool n 1514 help 1515 An arch should select this symbol if it can support kernel stacks 1516 in vmalloc space. This means: 1517 1518 - vmalloc space must be large enough to hold many kernel stacks. 1519 This may rule out many 32-bit architectures. 1520 1521 - Stacks in vmalloc space need to work reliably. For example, if 1522 vmap page tables are created on demand, either this mechanism 1523 needs to work while the stack points to a virtual address with 1524 unpopulated page tables or arch code (switch_to() and switch_mm(), 1525 most likely) needs to ensure that the stack's page table entries 1526 are populated before running on a possibly unpopulated stack. 1527 1528 - If the stack overflows into a guard page, something reasonable 1529 should happen. The definition of "reasonable" is flexible, but 1530 instantly rebooting without logging anything would be unfriendly. 1531 1532config VMAP_STACK 1533 default y 1534 bool "Use a virtually-mapped stack" 1535 depends on HAVE_ARCH_VMAP_STACK 1536 depends on !KASAN || KASAN_HW_TAGS || KASAN_VMALLOC 1537 help 1538 Enable this if you want the use virtually-mapped kernel stacks 1539 with guard pages. This causes kernel stack overflows to be 1540 caught immediately rather than causing difficult-to-diagnose 1541 corruption. 1542 1543 To use this with software KASAN modes, the architecture must support 1544 backing virtual mappings with real shadow memory, and KASAN_VMALLOC 1545 must be enabled. 1546 1547config HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET 1548 def_bool n 1549 help 1550 An arch should select this symbol if it can support kernel stack 1551 offset randomization with a call to add_random_kstack_offset() 1552 during syscall entry. Careful removal of -fstack-protector-strong and 1553 -fstack-protector should also be applied to the entry code and 1554 closely examined, as the artificial stack bump looks like an array 1555 to the compiler, so it will attempt to add canary checks regardless 1556 of the static branch state. 1557 1558config RANDOMIZE_KSTACK_OFFSET 1559 bool "Support for randomizing kernel stack offset on syscall entry" if EXPERT 1560 default y 1561 depends on HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET 1562 help 1563 The kernel stack offset can be randomized (after pt_regs) by 1564 roughly 5 bits of entropy, frustrating memory corruption 1565 attacks that depend on stack address determinism or 1566 cross-syscall address exposures. 1567 1568 The feature is controlled via the "randomize_kstack_offset=on/off" 1569 kernel boot param, and if turned off has zero overhead due to its use 1570 of static branches (see JUMP_LABEL). 1571 1572 If unsure, say Y. 1573 1574config RANDOMIZE_KSTACK_OFFSET_DEFAULT 1575 bool "Default state of kernel stack offset randomization" 1576 depends on RANDOMIZE_KSTACK_OFFSET 1577 help 1578 Kernel stack offset randomization is controlled by kernel boot param 1579 "randomize_kstack_offset=on/off", and this config chooses the default 1580 boot state. 1581 1582config ARCH_OPTIONAL_KERNEL_RWX 1583 def_bool n 1584 1585config ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 1586 def_bool n 1587 1588config ARCH_HAS_STRICT_KERNEL_RWX 1589 def_bool n 1590 1591config STRICT_KERNEL_RWX 1592 bool "Make kernel text and rodata read-only" if ARCH_OPTIONAL_KERNEL_RWX 1593 depends on ARCH_HAS_STRICT_KERNEL_RWX 1594 default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 1595 help 1596 If this is set, kernel text and rodata memory will be made read-only, 1597 and non-text memory will be made non-executable. This provides 1598 protection against certain security exploits (e.g. executing the heap 1599 or modifying text) 1600 1601 These features are considered standard security practice these days. 1602 You should say Y here in almost all cases. 1603 1604config ARCH_HAS_STRICT_MODULE_RWX 1605 def_bool n 1606 1607config STRICT_MODULE_RWX 1608 bool "Set loadable kernel module data as NX and text as RO" if ARCH_OPTIONAL_KERNEL_RWX 1609 depends on ARCH_HAS_STRICT_MODULE_RWX && MODULES 1610 default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 1611 help 1612 If this is set, module text and rodata memory will be made read-only, 1613 and non-text memory will be made non-executable. This provides 1614 protection against certain security exploits (e.g. writing to text) 1615 1616# select if the architecture provides an asm/dma-direct.h header 1617config ARCH_HAS_PHYS_TO_DMA 1618 bool 1619 1620config ARCH_HAS_CPU_RESCTRL 1621 bool 1622 help 1623 An architecture selects this option to indicate that the necessary 1624 hooks are provided to support the common memory system usage 1625 monitoring and control interfaces provided by the 'resctrl' 1626 filesystem (see RESCTRL_FS). 1627 1628config HAVE_ARCH_COMPILER_H 1629 bool 1630 help 1631 An architecture can select this if it provides an 1632 asm/compiler.h header that should be included after 1633 linux/compiler-*.h in order to override macro definitions that those 1634 headers generally provide. 1635 1636config HAVE_ARCH_LIBGCC_H 1637 bool 1638 help 1639 An architecture can select this if it provides an 1640 asm/libgcc.h header that should be included after 1641 linux/libgcc.h in order to override macro definitions that 1642 header generally provides. 1643 1644config HAVE_ARCH_PREL32_RELOCATIONS 1645 bool 1646 help 1647 May be selected by an architecture if it supports place-relative 1648 32-bit relocations, both in the toolchain and in the module loader, 1649 in which case relative references can be used in special sections 1650 for PCI fixup, initcalls etc which are only half the size on 64 bit 1651 architectures, and don't require runtime relocation on relocatable 1652 kernels. 1653 1654config ARCH_USE_MEMREMAP_PROT 1655 bool 1656 1657config LOCK_EVENT_COUNTS 1658 bool "Locking event counts collection" 1659 depends on DEBUG_FS 1660 help 1661 Enable light-weight counting of various locking related events 1662 in the system with minimal performance impact. This reduces 1663 the chance of application behavior change because of timing 1664 differences. The counts are reported via debugfs. 1665 1666# Select if the architecture has support for applying RELR relocations. 1667config ARCH_HAS_RELR 1668 bool 1669 1670config RELR 1671 bool "Use RELR relocation packing" 1672 depends on ARCH_HAS_RELR && TOOLS_SUPPORT_RELR 1673 default y 1674 help 1675 Store the kernel's dynamic relocations in the RELR relocation packing 1676 format. Requires a compatible linker (LLD supports this feature), as 1677 well as compatible NM and OBJCOPY utilities (llvm-nm and llvm-objcopy 1678 are compatible). 1679 1680config ARCH_HAS_MEM_ENCRYPT 1681 bool 1682 1683config ARCH_HAS_CC_PLATFORM 1684 bool 1685 1686config HAVE_SPARSE_SYSCALL_NR 1687 bool 1688 help 1689 An architecture should select this if its syscall numbering is sparse 1690 to save space. For example, MIPS architecture has a syscall array with 1691 entries at 4000, 5000 and 6000 locations. This option turns on syscall 1692 related optimizations for a given architecture. 1693 1694config ARCH_HAS_VDSO_ARCH_DATA 1695 depends on HAVE_GENERIC_VDSO 1696 bool 1697 1698config ARCH_HAS_VDSO_TIME_DATA 1699 bool 1700 1701config HAVE_STATIC_CALL 1702 bool 1703 1704config HAVE_STATIC_CALL_INLINE 1705 bool 1706 depends on HAVE_STATIC_CALL 1707 select OBJTOOL 1708 1709config HAVE_PREEMPT_DYNAMIC 1710 bool 1711 1712config HAVE_PREEMPT_DYNAMIC_CALL 1713 bool 1714 depends on HAVE_STATIC_CALL 1715 select HAVE_PREEMPT_DYNAMIC 1716 help 1717 An architecture should select this if it can handle the preemption 1718 model being selected at boot time using static calls. 1719 1720 Where an architecture selects HAVE_STATIC_CALL_INLINE, any call to a 1721 preemption function will be patched directly. 1722 1723 Where an architecture does not select HAVE_STATIC_CALL_INLINE, any 1724 call to a preemption function will go through a trampoline, and the 1725 trampoline will be patched. 1726 1727 It is strongly advised to support inline static call to avoid any 1728 overhead. 1729 1730config HAVE_PREEMPT_DYNAMIC_KEY 1731 bool 1732 depends on HAVE_ARCH_JUMP_LABEL 1733 select HAVE_PREEMPT_DYNAMIC 1734 help 1735 An architecture should select this if it can handle the preemption 1736 model being selected at boot time using static keys. 1737 1738 Each preemption function will be given an early return based on a 1739 static key. This should have slightly lower overhead than non-inline 1740 static calls, as this effectively inlines each trampoline into the 1741 start of its callee. This may avoid redundant work, and may 1742 integrate better with CFI schemes. 1743 1744 This will have greater overhead than using inline static calls as 1745 the call to the preemption function cannot be entirely elided. 1746 1747config ARCH_WANT_LD_ORPHAN_WARN 1748 bool 1749 help 1750 An arch should select this symbol once all linker sections are explicitly 1751 included, size-asserted, or discarded in the linker scripts. This is 1752 important because we never want expected sections to be placed heuristically 1753 by the linker, since the locations of such sections can change between linker 1754 versions. 1755 1756config HAVE_ARCH_PFN_VALID 1757 bool 1758 1759config ARCH_SUPPORTS_DEBUG_PAGEALLOC 1760 bool 1761 1762config ARCH_SUPPORTS_PAGE_TABLE_CHECK 1763 bool 1764 1765config ARCH_SPLIT_ARG64 1766 bool 1767 help 1768 If a 32-bit architecture requires 64-bit arguments to be split into 1769 pairs of 32-bit arguments, select this option. 1770 1771config ARCH_HAS_ELFCORE_COMPAT 1772 bool 1773 1774config ARCH_HAS_PARANOID_L1D_FLUSH 1775 bool 1776 1777config ARCH_HAVE_TRACE_MMIO_ACCESS 1778 bool 1779 1780config DYNAMIC_SIGFRAME 1781 bool 1782 1783# Select, if arch has a named attribute group bound to NUMA device nodes. 1784config HAVE_ARCH_NODE_DEV_GROUP 1785 bool 1786 1787config ARCH_HAS_HW_PTE_YOUNG 1788 bool 1789 help 1790 Architectures that select this option are capable of setting the 1791 accessed bit in PTE entries when using them as part of linear address 1792 translations. Architectures that require runtime check should select 1793 this option and override arch_has_hw_pte_young(). 1794 1795config ARCH_HAS_NONLEAF_PMD_YOUNG 1796 bool 1797 help 1798 Architectures that select this option are capable of setting the 1799 accessed bit in non-leaf PMD entries when using them as part of linear 1800 address translations. Page table walkers that clear the accessed bit 1801 may use this capability to reduce their search space. 1802 1803config ARCH_HAS_KERNEL_FPU_SUPPORT 1804 bool 1805 help 1806 Architectures that select this option can run floating-point code in 1807 the kernel, as described in Documentation/core-api/floating-point.rst. 1808 1809config ARCH_VMLINUX_NEEDS_RELOCS 1810 bool 1811 help 1812 Whether the architecture needs vmlinux to be built with static 1813 relocations preserved. This is used by some architectures to 1814 construct bespoke relocation tables for KASLR. 1815 1816# Select if architecture uses the common generic TIF bits 1817config HAVE_GENERIC_TIF_BITS 1818 bool 1819 1820source "kernel/gcov/Kconfig" 1821 1822source "scripts/gcc-plugins/Kconfig" 1823 1824config FUNCTION_ALIGNMENT_4B 1825 bool 1826 1827config FUNCTION_ALIGNMENT_8B 1828 bool 1829 1830config FUNCTION_ALIGNMENT_16B 1831 bool 1832 1833config FUNCTION_ALIGNMENT_32B 1834 bool 1835 1836config FUNCTION_ALIGNMENT_64B 1837 bool 1838 1839config FUNCTION_ALIGNMENT 1840 int 1841 default 64 if FUNCTION_ALIGNMENT_64B 1842 default 32 if FUNCTION_ALIGNMENT_32B 1843 default 16 if FUNCTION_ALIGNMENT_16B 1844 default 8 if FUNCTION_ALIGNMENT_8B 1845 default 4 if FUNCTION_ALIGNMENT_4B 1846 default 0 1847 1848config CC_HAS_MIN_FUNCTION_ALIGNMENT 1849 # Detect availability of the GCC option -fmin-function-alignment which 1850 # guarantees minimal alignment for all functions, unlike 1851 # -falign-functions which the compiler ignores for cold functions. 1852 def_bool $(cc-option, -fmin-function-alignment=8) 1853 1854config CC_HAS_SANE_FUNCTION_ALIGNMENT 1855 # Set if the guaranteed alignment with -fmin-function-alignment is 1856 # available or extra care is required in the kernel. Clang provides 1857 # strict alignment always, even with -falign-functions. 1858 def_bool CC_HAS_MIN_FUNCTION_ALIGNMENT || CC_IS_CLANG 1859 1860config ARCH_NEED_CMPXCHG_1_EMU 1861 bool 1862 1863config ARCH_WANTS_PRE_LINK_VMLINUX 1864 bool 1865 help 1866 An architecture can select this if it provides arch/<arch>/tools/Makefile 1867 with .arch.vmlinux.o target to be linked into vmlinux. 1868 1869config ARCH_HAS_CPU_ATTACK_VECTORS 1870 bool 1871 1872config HAVE_ARCH_GET_SECUREBOOT 1873 def_bool EFI 1874 1875endmenu 1876