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