projects/linux·blob 2c455ddc · refs

1843 lines · 54.6 KiB

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_TABLE_FREE
530 bool
531
532config MMU_GATHER_RCU_TABLE_FREE
533 bool
534 select MMU_GATHER_TABLE_FREE
535
536config MMU_GATHER_PAGE_SIZE
537 bool
538
539config MMU_GATHER_NO_RANGE
540 bool
541 select MMU_GATHER_MERGE_VMAS
542
543config MMU_GATHER_NO_FLUSH_CACHE
544 bool
545
546config MMU_GATHER_MERGE_VMAS
547 bool
548
549config MMU_GATHER_NO_GATHER
550 bool
551 depends on MMU_GATHER_TABLE_FREE
552
553config ARCH_WANT_IRQS_OFF_ACTIVATE_MM
554 bool
555 help
556 Temporary select until all architectures can be converted to have
557 irqs disabled over activate_mm. Architectures that do IPI based TLB
558 shootdowns should enable this.
559
560# Use normal mm refcounting for MMU_LAZY_TLB kernel thread references.
561# MMU_LAZY_TLB_REFCOUNT=n can improve the scalability of context switching
562# to/from kernel threads when the same mm is running on a lot of CPUs (a large
563# multi-threaded application), by reducing contention on the mm refcount.
564#
565# This can be disabled if the architecture ensures no CPUs are using an mm as a
566# "lazy tlb" beyond its final refcount (i.e., by the time __mmdrop frees the mm
567# or its kernel page tables). This could be arranged by arch_exit_mmap(), or
568# final exit(2) TLB flush, for example.
569#
570# To implement this, an arch *must*:
571# Ensure the _lazy_tlb variants of mmgrab/mmdrop are used when manipulating
572# the lazy tlb reference of a kthread's ->active_mm (non-arch code has been
573# converted already).
574config MMU_LAZY_TLB_REFCOUNT
575 def_bool y
576 depends on !MMU_LAZY_TLB_SHOOTDOWN
577
578# This option allows MMU_LAZY_TLB_REFCOUNT=n. It ensures no CPUs are using an
579# mm as a lazy tlb beyond its last reference count, by shooting down these
580# users before the mm is deallocated. __mmdrop() first IPIs all CPUs that may
581# be using the mm as a lazy tlb, so that they may switch themselves to using
582# init_mm for their active mm. mm_cpumask(mm) is used to determine which CPUs
583# may be using mm as a lazy tlb mm.
584#
585# To implement this, an arch *must*:
586# - At the time of the final mmdrop of the mm, ensure mm_cpumask(mm) contains
587# at least all possible CPUs in which the mm is lazy.
588# - It must meet the requirements for MMU_LAZY_TLB_REFCOUNT=n (see above).
589config MMU_LAZY_TLB_SHOOTDOWN
590 bool
591
592config ARCH_HAVE_NMI_SAFE_CMPXCHG
593 bool
594
595config ARCH_HAVE_EXTRA_ELF_NOTES
596 bool
597 help
598 An architecture should select this in order to enable adding an
599 arch-specific ELF note section to core files. It must provide two
600 functions: elf_coredump_extra_notes_size() and
601 elf_coredump_extra_notes_write() which are invoked by the ELF core
602 dumper.
603
604config ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
605 bool
606
607config HAVE_ALIGNED_STRUCT_PAGE
608 bool
609 help
610 This makes sure that struct pages are double word aligned and that
611 e.g. the SLUB allocator can perform double word atomic operations
612 on a struct page for better performance. However selecting this
613 might increase the size of a struct page by a word.
614
615config HAVE_CMPXCHG_LOCAL
616 bool
617
618config HAVE_CMPXCHG_DOUBLE
619 bool
620
621config ARCH_WEAK_RELEASE_ACQUIRE
622 bool
623
624config ARCH_WANT_IPC_PARSE_VERSION
625 bool
626
627config ARCH_WANT_COMPAT_IPC_PARSE_VERSION
628 bool
629
630config ARCH_WANT_OLD_COMPAT_IPC
631 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
632 bool
633
634config HAVE_ARCH_SECCOMP
635 bool
636 help
637 An arch should select this symbol to support seccomp mode 1 (the fixed
638 syscall policy), and must provide an overrides for __NR_seccomp_sigreturn,
639 and compat syscalls if the asm-generic/seccomp.h defaults need adjustment:
640 - __NR_seccomp_read_32
641 - __NR_seccomp_write_32
642 - __NR_seccomp_exit_32
643 - __NR_seccomp_sigreturn_32
644
645config HAVE_ARCH_SECCOMP_FILTER
646 bool
647 select HAVE_ARCH_SECCOMP
648 help
649 An arch should select this symbol if it provides all of these things:
650 - all the requirements for HAVE_ARCH_SECCOMP
651 - syscall_get_arch()
652 - syscall_get_arguments()
653 - syscall_rollback()
654 - syscall_set_return_value()
655 - SIGSYS siginfo_t support
656 - secure_computing is called from a ptrace_event()-safe context
657 - secure_computing return value is checked and if false it
658 results in the system call being skipped immediately.
659 - seccomp syscall wired up
660 - if !HAVE_SPARSE_SYSCALL_NR, have SECCOMP_ARCH_NATIVE,
661 SECCOMP_ARCH_NATIVE_NR, SECCOMP_ARCH_NATIVE_NAME defined. If
662 COMPAT is supported, have the SECCOMP_ARCH_COMPAT* defines too.
663
664config SECCOMP
665 prompt "Enable seccomp to safely execute untrusted bytecode"
666 def_bool y
667 depends on HAVE_ARCH_SECCOMP
668 help
669 This kernel feature is useful for number crunching applications
670 that may need to handle untrusted bytecode during their
671 execution. By using pipes or other transports made available
672 to the process as file descriptors supporting the read/write
673 syscalls, it's possible to isolate those applications in their
674 own address space using seccomp. Once seccomp is enabled via
675 prctl(PR_SET_SECCOMP) or the seccomp() syscall, it cannot be
676 disabled and the task is only allowed to execute a few safe
677 syscalls defined by each seccomp mode.
678
679 If unsure, say Y.
680
681config SECCOMP_FILTER
682 def_bool y
683 depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET
684 help
685 Enable tasks to build secure computing environments defined
686 in terms of Berkeley Packet Filter programs which implement
687 task-defined system call filtering polices.
688
689 See Documentation/userspace-api/seccomp_filter.rst for details.
690
691config SECCOMP_CACHE_DEBUG
692 bool "Show seccomp filter cache status in /proc/pid/seccomp_cache"
693 depends on SECCOMP_FILTER && !HAVE_SPARSE_SYSCALL_NR
694 depends on PROC_FS
695 help
696 This enables the /proc/pid/seccomp_cache interface to monitor
697 seccomp cache data. The file format is subject to change. Reading
698 the file requires CAP_SYS_ADMIN.
699
700 This option is for debugging only. Enabling presents the risk that
701 an adversary may be able to infer the seccomp filter logic.
702
703 If unsure, say N.
704
705config HAVE_ARCH_KSTACK_ERASE
706 bool
707 help
708 An architecture should select this if it has the code which
709 fills the used part of the kernel stack with the KSTACK_ERASE_POISON
710 value before returning from system calls.
711
712config HAVE_STACKPROTECTOR
713 bool
714 help
715 An arch should select this symbol if:
716 - it has implemented a stack canary (e.g. __stack_chk_guard)
717
718config STACKPROTECTOR
719 bool "Stack Protector buffer overflow detection"
720 depends on HAVE_STACKPROTECTOR
721 depends on $(cc-option,-fstack-protector)
722 default y
723 help
724 This option turns on the "stack-protector" GCC feature. This
725 feature puts, at the beginning of functions, a canary value on
726 the stack just before the return address, and validates
727 the value just before actually returning. Stack based buffer
728 overflows (that need to overwrite this return address) now also
729 overwrite the canary, which gets detected and the attack is then
730 neutralized via a kernel panic.
731
732 Functions will have the stack-protector canary logic added if they
733 have an 8-byte or larger character array on the stack.
734
735 This feature requires gcc version 4.2 or above, or a distribution
736 gcc with the feature backported ("-fstack-protector").
737
738 On an x86 "defconfig" build, this feature adds canary checks to
739 about 3% of all kernel functions, which increases kernel code size
740 by about 0.3%.
741
742config STACKPROTECTOR_STRONG
743 bool "Strong Stack Protector"
744 depends on STACKPROTECTOR
745 depends on $(cc-option,-fstack-protector-strong)
746 default y
747 help
748 Functions will have the stack-protector canary logic added in any
749 of the following conditions:
750
751 - local variable's address used as part of the right hand side of an
752 assignment or function argument
753 - local variable is an array (or union containing an array),
754 regardless of array type or length
755 - uses register local variables
756
757 This feature requires gcc version 4.9 or above, or a distribution
758 gcc with the feature backported ("-fstack-protector-strong").
759
760 On an x86 "defconfig" build, this feature adds canary checks to
761 about 20% of all kernel functions, which increases the kernel code
762 size by about 2%.
763
764config ARCH_SUPPORTS_SHADOW_CALL_STACK
765 bool
766 help
767 An architecture should select this if it supports the compiler's
768 Shadow Call Stack and implements runtime support for shadow stack
769 switching.
770
771config SHADOW_CALL_STACK
772 bool "Shadow Call Stack"
773 depends on ARCH_SUPPORTS_SHADOW_CALL_STACK
774 depends on DYNAMIC_FTRACE_WITH_ARGS || DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER
775 depends on MMU
776 help
777 This option enables the compiler's Shadow Call Stack, which
778 uses a shadow stack to protect function return addresses from
779 being overwritten by an attacker. More information can be found
780 in the compiler's documentation:
781
782 - Clang: https://clang.llvm.org/docs/ShadowCallStack.html
783 - GCC: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#Instrumentation-Options
784
785 Note that security guarantees in the kernel differ from the
786 ones documented for user space. The kernel must store addresses
787 of shadow stacks in memory, which means an attacker capable of
788 reading and writing arbitrary memory may be able to locate them
789 and hijack control flow by modifying the stacks.
790
791config DYNAMIC_SCS
792 bool
793 help
794 Set by the arch code if it relies on code patching to insert the
795 shadow call stack push and pop instructions rather than on the
796 compiler.
797
798config LTO
799 bool
800 help
801 Selected if the kernel will be built using the compiler's LTO feature.
802
803config LTO_CLANG
804 bool
805 select LTO
806 help
807 Selected if the kernel will be built using Clang's LTO feature.
808
809config ARCH_SUPPORTS_LTO_CLANG
810 bool
811 help
812 An architecture should select this option if it supports:
813 - compiling with Clang,
814 - compiling inline assembly with Clang's integrated assembler,
815 - and linking with LLD.
816
817config ARCH_SUPPORTS_LTO_CLANG_THIN
818 bool
819 help
820 An architecture should select this option if it can support Clang's
821 ThinLTO mode.
822
823config HAS_LTO_CLANG
824 def_bool y
825 depends on CC_IS_CLANG && LD_IS_LLD && AS_IS_LLVM
826 depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm)
827 depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm)
828 depends on ARCH_SUPPORTS_LTO_CLANG
829 depends on !FTRACE_MCOUNT_USE_RECORDMCOUNT
830 depends on !GCOV_KERNEL
831 help
832 The compiler and Kconfig options support building with Clang's
833 LTO.
834
835choice
836 prompt "Link Time Optimization (LTO)"
837 default LTO_NONE
838 help
839 This option enables Link Time Optimization (LTO), which allows the
840 compiler to optimize binaries globally.
841
842 If unsure, select LTO_NONE. Note that LTO is very resource-intensive
843 so it's disabled by default.
844
845config LTO_NONE
846 bool "None"
847 help
848 Build the kernel normally, without Link Time Optimization (LTO).
849
850config LTO_CLANG_FULL
851 bool "Clang Full LTO (EXPERIMENTAL)"
852 depends on HAS_LTO_CLANG
853 depends on !COMPILE_TEST
854 select LTO_CLANG
855 help
856 This option enables Clang's full Link Time Optimization (LTO), which
857 allows the compiler to optimize the kernel globally. If you enable
858 this option, the compiler generates LLVM bitcode instead of ELF
859 object files, and the actual compilation from bitcode happens at
860 the LTO link step, which may take several minutes depending on the
861 kernel configuration. More information can be found from LLVM's
862 documentation:
863
864 https://llvm.org/docs/LinkTimeOptimization.html
865
866 During link time, this option can use a large amount of RAM, and
867 may take much longer than the ThinLTO option.
868
869config LTO_CLANG_THIN
870 bool "Clang ThinLTO (EXPERIMENTAL)"
871 depends on HAS_LTO_CLANG && ARCH_SUPPORTS_LTO_CLANG_THIN
872 select LTO_CLANG
873 help
874 This option enables Clang's ThinLTO, which allows for parallel
875 optimization and faster incremental compiles compared to the
876 CONFIG_LTO_CLANG_FULL option. More information can be found
877 from Clang's documentation:
878
879 https://clang.llvm.org/docs/ThinLTO.html
880
881 If unsure, say Y.
882
883config LTO_CLANG_THIN_DIST
884 bool "Clang ThinLTO in distributed mode (EXPERIMENTAL)"
885 depends on HAS_LTO_CLANG && ARCH_SUPPORTS_LTO_CLANG_THIN
886 select LTO_CLANG
887 help
888 This option enables Clang's ThinLTO in distributed build mode.
889 In this mode, the linker performs the thin-link, generating
890 ThinLTO index files. Subsequently, the build system explicitly
891 invokes ThinLTO backend compilation using these index files
892 and pre-linked IR objects. The resulting native object files
893 are with the .thinlto-native.o suffix.
894
895 This build mode offers improved visibility into the ThinLTO
896 process through explicit subcommand exposure. It also makes
897 final native object files directly available, benefiting
898 tools like objtool and kpatch. Additionally, it provides
899 crucial granular control over back-end options, enabling
900 module-specific compiler options, and simplifies debugging.
901endchoice
902
903config AUTOFDO_CLANG
904 bool "Enable Clang's AutoFDO build (EXPERIMENTAL)"
905 depends on CC_IS_CLANG
906 help
907 This option enables Clang’s AutoFDO build. When
908 an AutoFDO profile is specified in variable
909 CLANG_AUTOFDO_PROFILE during the build process,
910 Clang uses the profile to optimize the kernel.
911
912 If no profile is specified, AutoFDO options are
913 still passed to Clang to facilitate the collection
914 of perf data for creating an AutoFDO profile in
915 subsequent builds.
916
917 If unsure, say N.
918
919config PROPELLER_CLANG
920 bool "Enable Clang's Propeller build"
921 depends on CC_IS_CLANG && CLANG_VERSION >= 190000
922 depends on $(cc-option,-fbasic-block-sections=list=/dev/null)
923 help
924 This option enables Clang’s Propeller build. When the Propeller
925 profiles is specified in variable CLANG_PROPELLER_PROFILE_PREFIX
926 during the build process, Clang uses the profiles to optimize
927 the kernel.
928
929 If no profile is specified, Propeller options are still passed
930 to Clang to facilitate the collection of perf data for creating
931 the Propeller profiles in subsequent builds.
932
933 If unsure, say N.
934
935config ARCH_SUPPORTS_CFI
936 bool
937 help
938 An architecture should select this option if it can support Kernel
939 Control-Flow Integrity (CFI) checking (-fsanitize=kcfi).
940
941config ARCH_USES_CFI_TRAPS
942 bool
943 help
944 An architecture should select this option if it requires the
945 .kcfi_traps section for KCFI trap handling.
946
947config ARCH_USES_CFI_GENERIC_LLVM_PASS
948 bool
949 help
950 An architecture should select this option if it uses the generic
951 KCFIPass in LLVM to expand kCFI bundles instead of architecture-specific
952 lowering.
953
954config CFI
955 bool "Use Kernel Control Flow Integrity (kCFI)"
956 default CFI_CLANG
957 depends on ARCH_SUPPORTS_CFI
958 depends on $(cc-option,-fsanitize=kcfi)
959 help
960 This option enables forward-edge Control Flow Integrity (CFI)
961 checking, where the compiler injects a runtime check to each
962 indirect function call to ensure the target is a valid function with
963 the correct static type. This restricts possible call targets and
964 makes it more difficult for an attacker to exploit bugs that allow
965 the modification of stored function pointers. More information can be
966 found from Clang's documentation:
967
968 https://clang.llvm.org/docs/ControlFlowIntegrity.html
969
970config CFI_CLANG
971 bool
972 transitional
973 help
974 Transitional config for CFI_CLANG to CFI migration.
975
976config CFI_ICALL_NORMALIZE_INTEGERS
977 bool "Normalize CFI tags for integers"
978 depends on CFI
979 depends on HAVE_CFI_ICALL_NORMALIZE_INTEGERS
980 help
981 This option normalizes the CFI tags for integer types so that all
982 integer types of the same size and signedness receive the same CFI
983 tag.
984
985 The option is separate from CONFIG_RUST because it affects the ABI.
986 When working with build systems that care about the ABI, it is
987 convenient to be able to turn on this flag first, before Rust is
988 turned on.
989
990 This option is necessary for using CFI with Rust. If unsure, say N.
991
992config HAVE_CFI_ICALL_NORMALIZE_INTEGERS
993 def_bool y
994 depends on $(cc-option,-fsanitize=kcfi -fsanitize-cfi-icall-experimental-normalize-integers)
995 # With GCOV/KASAN we need this fix: https://github.com/llvm/llvm-project/pull/104826
996 depends on CLANG_VERSION >= 190103 || (!GCOV_KERNEL && !KASAN_GENERIC && !KASAN_SW_TAGS)
997
998config HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC
999 def_bool y
1000 depends on HAVE_CFI_ICALL_NORMALIZE_INTEGERS
1001 depends on ARM64 || X86_64
1002 # With GCOV/KASAN we need this fix: https://github.com/rust-lang/rust/pull/129373
1003 depends on RUSTC_LLVM_VERSION >= 190103 || \
1004 (!GCOV_KERNEL && !KASAN_GENERIC && !KASAN_SW_TAGS)
1005
1006config CFI_PERMISSIVE
1007 bool "Use CFI in permissive mode"
1008 depends on CFI
1009 help
1010 When selected, Control Flow Integrity (CFI) violations result in a
1011 warning instead of a kernel panic. This option should only be used
1012 for finding indirect call type mismatches during development.
1013
1014 If unsure, say N.
1015
1016config HAVE_ARCH_WITHIN_STACK_FRAMES
1017 bool
1018 help
1019 An architecture should select this if it can walk the kernel stack
1020 frames to determine if an object is part of either the arguments
1021 or local variables (i.e. that it excludes saved return addresses,
1022 and similar) by implementing an inline arch_within_stack_frames(),
1023 which is used by CONFIG_HARDENED_USERCOPY.
1024
1025config HAVE_CONTEXT_TRACKING_USER
1026 bool
1027 help
1028 Provide kernel/user boundaries probes necessary for subsystems
1029 that need it, such as userspace RCU extended quiescent state.
1030 Syscalls need to be wrapped inside user_exit()-user_enter(), either
1031 optimized behind static key or through the slow path using TIF_NOHZ
1032 flag. Exceptions handlers must be wrapped as well. Irqs are already
1033 protected inside ct_irq_enter/ct_irq_exit() but preemption or signal
1034 handling on irq exit still need to be protected.
1035
1036config HAVE_CONTEXT_TRACKING_USER_OFFSTACK
1037 bool
1038 help
1039 Architecture neither relies on exception_enter()/exception_exit()
1040 nor on schedule_user(). Also preempt_schedule_notrace() and
1041 preempt_schedule_irq() can't be called in a preemptible section
1042 while context tracking is CT_STATE_USER. This feature reflects a sane
1043 entry implementation where the following requirements are met on
1044 critical entry code, ie: before user_exit() or after user_enter():
1045
1046 - Critical entry code isn't preemptible (or better yet:
1047 not interruptible).
1048 - No use of RCU read side critical sections, unless ct_nmi_enter()
1049 got called.
1050 - No use of instrumentation, unless instrumentation_begin() got
1051 called.
1052
1053config HAVE_TIF_NOHZ
1054 bool
1055 help
1056 Arch relies on TIF_NOHZ and syscall slow path to implement context
1057 tracking calls to user_enter()/user_exit().
1058
1059config HAVE_VIRT_CPU_ACCOUNTING
1060 bool
1061
1062config HAVE_VIRT_CPU_ACCOUNTING_IDLE
1063 bool
1064 help
1065 Architecture has its own way to account idle CPU time and therefore
1066 doesn't implement vtime_account_idle().
1067
1068config ARCH_HAS_SCALED_CPUTIME
1069 bool
1070
1071config HAVE_VIRT_CPU_ACCOUNTING_GEN
1072 bool
1073 default y if 64BIT
1074 help
1075 With VIRT_CPU_ACCOUNTING_GEN, cputime_t becomes 64-bit.
1076 Before enabling this option, arch code must be audited
1077 to ensure there are no races in concurrent read/write of
1078 cputime_t. For example, reading/writing 64-bit cputime_t on
1079 some 32-bit arches may require multiple accesses, so proper
1080 locking is needed to protect against concurrent accesses.
1081
1082config HAVE_IRQ_TIME_ACCOUNTING
1083 bool
1084 help
1085 Archs need to ensure they use a high enough resolution clock to
1086 support irq time accounting and then call enable_sched_clock_irqtime().
1087
1088config HAVE_PV_STEAL_CLOCK_GEN
1089 bool
1090
1091config HAVE_MOVE_PUD
1092 bool
1093 help
1094 Architectures that select this are able to move page tables at the
1095 PUD level. If there are only 3 page table levels, the move effectively
1096 happens at the PGD level.
1097
1098config HAVE_MOVE_PMD
1099 bool
1100 help
1101 Archs that select this are able to move page tables at the PMD level.
1102
1103config HAVE_ARCH_TRANSPARENT_HUGEPAGE
1104 bool
1105
1106config HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
1107 bool
1108
1109config HAVE_ARCH_HUGE_VMAP
1110 bool
1111
1112#
1113# Archs that select this would be capable of PMD-sized vmaps (i.e.,
1114# arch_vmap_pmd_supported() returns true). The VM_ALLOW_HUGE_VMAP flag
1115# must be used to enable allocations to use hugepages.
1116#
1117config HAVE_ARCH_HUGE_VMALLOC
1118 depends on HAVE_ARCH_HUGE_VMAP
1119 bool
1120
1121config ARCH_WANT_HUGE_PMD_SHARE
1122 bool
1123
1124# Archs that want to use pmd_mkwrite on kernel memory need it defined even
1125# if there are no userspace memory management features that use it
1126config ARCH_WANT_KERNEL_PMD_MKWRITE
1127 bool
1128
1129config ARCH_WANT_PMD_MKWRITE
1130 def_bool TRANSPARENT_HUGEPAGE || ARCH_WANT_KERNEL_PMD_MKWRITE
1131
1132config HAVE_ARCH_SOFT_DIRTY
1133 bool
1134
1135config HAVE_MOD_ARCH_SPECIFIC
1136 bool
1137 help
1138 The arch uses struct mod_arch_specific to store data. Many arches
1139 just need a simple module loader without arch specific data - those
1140 should not enable this.
1141
1142config MODULES_USE_ELF_RELA
1143 bool
1144 help
1145 Modules only use ELF RELA relocations. Modules with ELF REL
1146 relocations will give an error.
1147
1148config MODULES_USE_ELF_REL
1149 bool
1150 help
1151 Modules only use ELF REL relocations. Modules with ELF RELA
1152 relocations will give an error.
1153
1154config ARCH_WANTS_MODULES_DATA_IN_VMALLOC
1155 bool
1156 help
1157 For architectures like powerpc/32 which have constraints on module
1158 allocation and need to allocate module data outside of module area.
1159
1160config ARCH_WANTS_MODULES_TEXT_SECTIONS
1161 bool
1162 help
1163 For architectures like 32-bit parisc which require that functions in
1164 modules have to keep code in own text sections (-ffunction-sections)
1165 and to avoid merging all text into one big text section,
1166
1167config ARCH_WANTS_EXECMEM_LATE
1168 bool
1169 help
1170 For architectures that do not allocate executable memory early on
1171 boot, but rather require its initialization late when there is
1172 enough entropy for module space randomization, for instance
1173 arm64.
1174
1175config ARCH_HAS_EXECMEM_ROX
1176 bool
1177 depends on MMU && !HIGHMEM
1178 help
1179 For architectures that support allocations of executable memory
1180 with read-only execute permissions. Architecture must implement
1181 execmem_fill_trapping_insns() callback to enable this.
1182
1183config HAVE_IRQ_EXIT_ON_IRQ_STACK
1184 bool
1185 help
1186 Architecture doesn't only execute the irq handler on the irq stack
1187 but also irq_exit(). This way we can process softirqs on this irq
1188 stack instead of switching to a new one when we call __do_softirq()
1189 in the end of an hardirq.
1190 This spares a stack switch and improves cache usage on softirq
1191 processing.
1192
1193config HAVE_SOFTIRQ_ON_OWN_STACK
1194 bool
1195 help
1196 Architecture provides a function to run __do_softirq() on a
1197 separate stack.
1198
1199config SOFTIRQ_ON_OWN_STACK
1200 def_bool HAVE_SOFTIRQ_ON_OWN_STACK && !PREEMPT_RT
1201
1202config ALTERNATE_USER_ADDRESS_SPACE
1203 bool
1204 help
1205 Architectures set this when the CPU uses separate address
1206 spaces for kernel and user space pointers. In this case, the
1207 access_ok() check on a __user pointer is skipped.
1208
1209config PGTABLE_LEVELS
1210 int
1211 default 2
1212
1213config ARCH_HAS_ELF_RANDOMIZE
1214 bool
1215 help
1216 An architecture supports choosing randomized locations for
1217 stack, mmap, brk, and ET_DYN. Defined functions:
1218 - arch_mmap_rnd()
1219 - arch_randomize_brk()
1220
1221config HAVE_ARCH_MMAP_RND_BITS
1222 bool
1223 help
1224 An arch should select this symbol if it supports setting a variable
1225 number of bits for use in establishing the base address for mmap
1226 allocations, has MMU enabled and provides values for both:
1227 - ARCH_MMAP_RND_BITS_MIN
1228 - ARCH_MMAP_RND_BITS_MAX
1229
1230config HAVE_EXIT_THREAD
1231 bool
1232 help
1233 An architecture implements exit_thread.
1234
1235config ARCH_MMAP_RND_BITS_MIN
1236 int
1237
1238config ARCH_MMAP_RND_BITS_MAX
1239 int
1240
1241config ARCH_MMAP_RND_BITS_DEFAULT
1242 int
1243
1244config ARCH_MMAP_RND_BITS
1245 int "Number of bits to use for ASLR of mmap base address" if EXPERT
1246 range ARCH_MMAP_RND_BITS_MIN ARCH_MMAP_RND_BITS_MAX
1247 default ARCH_MMAP_RND_BITS_DEFAULT if ARCH_MMAP_RND_BITS_DEFAULT
1248 default ARCH_MMAP_RND_BITS_MIN
1249 depends on HAVE_ARCH_MMAP_RND_BITS
1250 help
1251 This value can be used to select the number of bits to use to
1252 determine the random offset to the base address of vma regions
1253 resulting from mmap allocations. This value will be bounded
1254 by the architecture's minimum and maximum supported values.
1255
1256 This value can be changed after boot using the
1257 /proc/sys/vm/mmap_rnd_bits tunable
1258
1259config HAVE_ARCH_MMAP_RND_COMPAT_BITS
1260 bool
1261 help
1262 An arch should select this symbol if it supports running applications
1263 in compatibility mode, supports setting a variable number of bits for
1264 use in establishing the base address for mmap allocations, has MMU
1265 enabled and provides values for both:
1266 - ARCH_MMAP_RND_COMPAT_BITS_MIN
1267 - ARCH_MMAP_RND_COMPAT_BITS_MAX
1268
1269config ARCH_MMAP_RND_COMPAT_BITS_MIN
1270 int
1271
1272config ARCH_MMAP_RND_COMPAT_BITS_MAX
1273 int
1274
1275config ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
1276 int
1277
1278config ARCH_MMAP_RND_COMPAT_BITS
1279 int "Number of bits to use for ASLR of mmap base address for compatible applications" if EXPERT
1280 range ARCH_MMAP_RND_COMPAT_BITS_MIN ARCH_MMAP_RND_COMPAT_BITS_MAX
1281 default ARCH_MMAP_RND_COMPAT_BITS_DEFAULT if ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
1282 default ARCH_MMAP_RND_COMPAT_BITS_MIN
1283 depends on HAVE_ARCH_MMAP_RND_COMPAT_BITS
1284 help
1285 This value can be used to select the number of bits to use to
1286 determine the random offset to the base address of vma regions
1287 resulting from mmap allocations for compatible applications This
1288 value will be bounded by the architecture's minimum and maximum
1289 supported values.
1290
1291 This value can be changed after boot using the
1292 /proc/sys/vm/mmap_rnd_compat_bits tunable
1293
1294config HAVE_ARCH_COMPAT_MMAP_BASES
1295 bool
1296 help
1297 This allows 64bit applications to invoke 32-bit mmap() syscall
1298 and vice-versa 32-bit applications to call 64-bit mmap().
1299 Required for applications doing different bitness syscalls.
1300
1301config HAVE_PAGE_SIZE_4KB
1302 bool
1303
1304config HAVE_PAGE_SIZE_8KB
1305 bool
1306
1307config HAVE_PAGE_SIZE_16KB
1308 bool
1309
1310config HAVE_PAGE_SIZE_32KB
1311 bool
1312
1313config HAVE_PAGE_SIZE_64KB
1314 bool
1315
1316config HAVE_PAGE_SIZE_256KB
1317 bool
1318
1319choice
1320 prompt "MMU page size"
1321
1322config PAGE_SIZE_4KB
1323 bool "4KiB pages"
1324 depends on HAVE_PAGE_SIZE_4KB
1325 help
1326 This option select the standard 4KiB Linux page size and the only
1327 available option on many architectures. Using 4KiB page size will
1328 minimize memory consumption and is therefore recommended for low
1329 memory systems.
1330 Some software that is written for x86 systems makes incorrect
1331 assumptions about the page size and only runs on 4KiB pages.
1332
1333config PAGE_SIZE_8KB
1334 bool "8KiB pages"
1335 depends on HAVE_PAGE_SIZE_8KB
1336 help
1337 This option is the only supported page size on a few older
1338 processors, and can be slightly faster than 4KiB pages.
1339
1340config PAGE_SIZE_16KB
1341 bool "16KiB pages"
1342 depends on HAVE_PAGE_SIZE_16KB
1343 help
1344 This option is usually a good compromise between memory
1345 consumption and performance for typical desktop and server
1346 workloads, often saving a level of page table lookups compared
1347 to 4KB pages as well as reducing TLB pressure and overhead of
1348 per-page operations in the kernel at the expense of a larger
1349 page cache.
1350
1351config PAGE_SIZE_32KB
1352 bool "32KiB pages"
1353 depends on HAVE_PAGE_SIZE_32KB
1354 help
1355 Using 32KiB page size will result in slightly higher performance
1356 kernel at the price of higher memory consumption compared to
1357 16KiB pages. This option is available only on cnMIPS cores.
1358 Note that you will need a suitable Linux distribution to
1359 support this.
1360
1361config PAGE_SIZE_64KB
1362 bool "64KiB pages"
1363 depends on HAVE_PAGE_SIZE_64KB
1364 help
1365 Using 64KiB page size will result in slightly higher performance
1366 kernel at the price of much higher memory consumption compared to
1367 4KiB or 16KiB pages.
1368 This is not suitable for general-purpose workloads but the
1369 better performance may be worth the cost for certain types of
1370 supercomputing or database applications that work mostly with
1371 large in-memory data rather than small files.
1372
1373config PAGE_SIZE_256KB
1374 bool "256KiB pages"
1375 depends on HAVE_PAGE_SIZE_256KB
1376 help
1377 256KiB pages have little practical value due to their extreme
1378 memory usage. The kernel will only be able to run applications
1379 that have been compiled with '-zmax-page-size' set to 256KiB
1380 (the default is 64KiB or 4KiB on most architectures).
1381
1382endchoice
1383
1384config PAGE_SIZE_LESS_THAN_64KB
1385 def_bool y
1386 depends on !PAGE_SIZE_64KB
1387 depends on PAGE_SIZE_LESS_THAN_256KB
1388
1389config PAGE_SIZE_LESS_THAN_256KB
1390 def_bool y
1391 depends on !PAGE_SIZE_256KB
1392
1393config PAGE_SHIFT
1394 int
1395 default 12 if PAGE_SIZE_4KB
1396 default 13 if PAGE_SIZE_8KB
1397 default 14 if PAGE_SIZE_16KB
1398 default 15 if PAGE_SIZE_32KB
1399 default 16 if PAGE_SIZE_64KB
1400 default 18 if PAGE_SIZE_256KB
1401
1402# This allows to use a set of generic functions to determine mmap base
1403# address by giving priority to top-down scheme only if the process
1404# is not in legacy mode (compat task, unlimited stack size or
1405# sysctl_legacy_va_layout).
1406# Architecture that selects this option can provide its own version of:
1407# - STACK_RND_MASK
1408config ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
1409 bool
1410 depends on MMU
1411 select ARCH_HAS_ELF_RANDOMIZE
1412
1413config HAVE_OBJTOOL
1414 bool
1415
1416config HAVE_JUMP_LABEL_HACK
1417 bool
1418
1419config HAVE_NOINSTR_HACK
1420 bool
1421
1422config HAVE_NOINSTR_VALIDATION
1423 bool
1424
1425config HAVE_UACCESS_VALIDATION
1426 bool
1427 select OBJTOOL
1428
1429config HAVE_STACK_VALIDATION
1430 bool
1431 help
1432 Architecture supports objtool compile-time frame pointer rule
1433 validation.
1434
1435config HAVE_RELIABLE_STACKTRACE
1436 bool
1437 help
1438 Architecture has either save_stack_trace_tsk_reliable() or
1439 arch_stack_walk_reliable() function which only returns a stack trace
1440 if it can guarantee the trace is reliable.
1441
1442config HAVE_ARCH_HASH
1443 bool
1444 default n
1445 help
1446 If this is set, the architecture provides an <asm/hash.h>
1447 file which provides platform-specific implementations of some
1448 functions in <linux/hash.h> or fs/namei.c.
1449
1450config HAVE_ARCH_NVRAM_OPS
1451 bool
1452
1453config ISA_BUS_API
1454 def_bool ISA
1455
1456#
1457# ABI hall of shame
1458#
1459config CLONE_BACKWARDS
1460 bool
1461 help
1462 Architecture has tls passed as the 4th argument of clone(2),
1463 not the 5th one.
1464
1465config CLONE_BACKWARDS2
1466 bool
1467 help
1468 Architecture has the first two arguments of clone(2) swapped.
1469
1470config CLONE_BACKWARDS3
1471 bool
1472 help
1473 Architecture has tls passed as the 3rd argument of clone(2),
1474 not the 5th one.
1475
1476config ODD_RT_SIGACTION
1477 bool
1478 help
1479 Architecture has unusual rt_sigaction(2) arguments
1480
1481config OLD_SIGSUSPEND
1482 bool
1483 help
1484 Architecture has old sigsuspend(2) syscall, of one-argument variety
1485
1486config OLD_SIGSUSPEND3
1487 bool
1488 help
1489 Even weirder antique ABI - three-argument sigsuspend(2)
1490
1491config OLD_SIGACTION
1492 bool
1493 help
1494 Architecture has old sigaction(2) syscall. Nope, not the same
1495 as OLD_SIGSUSPEND | OLD_SIGSUSPEND3 - alpha has sigsuspend(2),
1496 but fairly different variant of sigaction(2), thanks to OSF/1
1497 compatibility...
1498
1499config COMPAT_OLD_SIGACTION
1500 bool
1501
1502config COMPAT_32BIT_TIME
1503 bool "Provide system calls for 32-bit time_t"
1504 default !64BIT || COMPAT
1505 help
1506 This enables 32 bit time_t support in addition to 64 bit time_t support.
1507 This is relevant on all 32-bit architectures, and 64-bit architectures
1508 as part of compat syscall handling.
1509
1510config ARCH_NO_PREEMPT
1511 bool
1512
1513config ARCH_SUPPORTS_RT
1514 bool
1515
1516config CPU_NO_EFFICIENT_FFS
1517 def_bool n
1518
1519config HAVE_ARCH_VMAP_STACK
1520 def_bool n
1521 help
1522 An arch should select this symbol if it can support kernel stacks
1523 in vmalloc space. This means:
1524
1525 - vmalloc space must be large enough to hold many kernel stacks.
1526 This may rule out many 32-bit architectures.
1527
1528 - Stacks in vmalloc space need to work reliably. For example, if
1529 vmap page tables are created on demand, either this mechanism
1530 needs to work while the stack points to a virtual address with
1531 unpopulated page tables or arch code (switch_to() and switch_mm(),
1532 most likely) needs to ensure that the stack's page table entries
1533 are populated before running on a possibly unpopulated stack.
1534
1535 - If the stack overflows into a guard page, something reasonable
1536 should happen. The definition of "reasonable" is flexible, but
1537 instantly rebooting without logging anything would be unfriendly.
1538
1539config VMAP_STACK
1540 default y
1541 bool "Use a virtually-mapped stack"
1542 depends on HAVE_ARCH_VMAP_STACK
1543 depends on !KASAN || KASAN_HW_TAGS || KASAN_VMALLOC
1544 help
1545 Enable this if you want the use virtually-mapped kernel stacks
1546 with guard pages. This causes kernel stack overflows to be
1547 caught immediately rather than causing difficult-to-diagnose
1548 corruption.
1549
1550 To use this with software KASAN modes, the architecture must support
1551 backing virtual mappings with real shadow memory, and KASAN_VMALLOC
1552 must be enabled.
1553
1554config HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
1555 def_bool n
1556 help
1557 An arch should select this symbol if it can support kernel stack
1558 offset randomization with a call to add_random_kstack_offset()
1559 during syscall entry. Careful removal of -fstack-protector-strong and
1560 -fstack-protector should also be applied to the entry code and
1561 closely examined, as the artificial stack bump looks like an array
1562 to the compiler, so it will attempt to add canary checks regardless
1563 of the static branch state.
1564
1565config RANDOMIZE_KSTACK_OFFSET
1566 bool "Support for randomizing kernel stack offset on syscall entry" if EXPERT
1567 default y
1568 depends on HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
1569 help
1570 The kernel stack offset can be randomized (after pt_regs) by
1571 roughly 5 bits of entropy, frustrating memory corruption
1572 attacks that depend on stack address determinism or
1573 cross-syscall address exposures.
1574
1575 The feature is controlled via the "randomize_kstack_offset=on/off"
1576 kernel boot param, and if turned off has zero overhead due to its use
1577 of static branches (see JUMP_LABEL).
1578
1579 If unsure, say Y.
1580
1581config RANDOMIZE_KSTACK_OFFSET_DEFAULT
1582 bool "Default state of kernel stack offset randomization"
1583 depends on RANDOMIZE_KSTACK_OFFSET
1584 help
1585 Kernel stack offset randomization is controlled by kernel boot param
1586 "randomize_kstack_offset=on/off", and this config chooses the default
1587 boot state.
1588
1589config ARCH_OPTIONAL_KERNEL_RWX
1590 def_bool n
1591
1592config ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
1593 def_bool n
1594
1595config ARCH_HAS_STRICT_KERNEL_RWX
1596 def_bool n
1597
1598config STRICT_KERNEL_RWX
1599 bool "Make kernel text and rodata read-only" if ARCH_OPTIONAL_KERNEL_RWX
1600 depends on ARCH_HAS_STRICT_KERNEL_RWX
1601 default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
1602 help
1603 If this is set, kernel text and rodata memory will be made read-only,
1604 and non-text memory will be made non-executable. This provides
1605 protection against certain security exploits (e.g. executing the heap
1606 or modifying text)
1607
1608 These features are considered standard security practice these days.
1609 You should say Y here in almost all cases.
1610
1611config ARCH_HAS_STRICT_MODULE_RWX
1612 def_bool n
1613
1614config STRICT_MODULE_RWX
1615 bool "Set loadable kernel module data as NX and text as RO" if ARCH_OPTIONAL_KERNEL_RWX
1616 depends on ARCH_HAS_STRICT_MODULE_RWX && MODULES
1617 default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
1618 help
1619 If this is set, module text and rodata memory will be made read-only,
1620 and non-text memory will be made non-executable. This provides
1621 protection against certain security exploits (e.g. writing to text)
1622
1623# select if the architecture provides an asm/dma-direct.h header
1624config ARCH_HAS_PHYS_TO_DMA
1625 bool
1626
1627config ARCH_HAS_CPU_RESCTRL
1628 bool
1629 help
1630 An architecture selects this option to indicate that the necessary
1631 hooks are provided to support the common memory system usage
1632 monitoring and control interfaces provided by the 'resctrl'
1633 filesystem (see RESCTRL_FS).
1634
1635config HAVE_ARCH_COMPILER_H
1636 bool
1637 help
1638 An architecture can select this if it provides an
1639 asm/compiler.h header that should be included after
1640 linux/compiler-*.h in order to override macro definitions that those
1641 headers generally provide.
1642
1643config HAVE_ARCH_LIBGCC_H
1644 bool
1645 help
1646 An architecture can select this if it provides an
1647 asm/libgcc.h header that should be included after
1648 linux/libgcc.h in order to override macro definitions that
1649 header generally provides.
1650
1651config HAVE_ARCH_PREL32_RELOCATIONS
1652 bool
1653 help
1654 May be selected by an architecture if it supports place-relative
1655 32-bit relocations, both in the toolchain and in the module loader,
1656 in which case relative references can be used in special sections
1657 for PCI fixup, initcalls etc which are only half the size on 64 bit
1658 architectures, and don't require runtime relocation on relocatable
1659 kernels.
1660
1661config ARCH_USE_MEMREMAP_PROT
1662 bool
1663
1664config LOCK_EVENT_COUNTS
1665 bool "Locking event counts collection"
1666 depends on DEBUG_FS
1667 help
1668 Enable light-weight counting of various locking related events
1669 in the system with minimal performance impact. This reduces
1670 the chance of application behavior change because of timing
1671 differences. The counts are reported via debugfs.
1672
1673# Select if the architecture has support for applying RELR relocations.
1674config ARCH_HAS_RELR
1675 bool
1676
1677config RELR
1678 bool "Use RELR relocation packing"
1679 depends on ARCH_HAS_RELR && TOOLS_SUPPORT_RELR
1680 default y
1681 help
1682 Store the kernel's dynamic relocations in the RELR relocation packing
1683 format. Requires a compatible linker (LLD supports this feature), as
1684 well as compatible NM and OBJCOPY utilities (llvm-nm and llvm-objcopy
1685 are compatible).
1686
1687config ARCH_HAS_MEM_ENCRYPT
1688 bool
1689
1690config ARCH_HAS_CC_PLATFORM
1691 bool
1692
1693config HAVE_SPARSE_SYSCALL_NR
1694 bool
1695 help
1696 An architecture should select this if its syscall numbering is sparse
1697 to save space. For example, MIPS architecture has a syscall array with
1698 entries at 4000, 5000 and 6000 locations. This option turns on syscall
1699 related optimizations for a given architecture.
1700
1701config ARCH_HAS_VDSO_ARCH_DATA
1702 bool
1703
1704config ARCH_HAS_VDSO_TIME_DATA
1705 bool
1706
1707config HAVE_STATIC_CALL
1708 bool
1709
1710config HAVE_STATIC_CALL_INLINE
1711 bool
1712 depends on HAVE_STATIC_CALL
1713 select OBJTOOL
1714
1715config ARCH_WANT_LD_ORPHAN_WARN
1716 bool
1717 help
1718 An arch should select this symbol once all linker sections are explicitly
1719 included, size-asserted, or discarded in the linker scripts. This is
1720 important because we never want expected sections to be placed heuristically
1721 by the linker, since the locations of such sections can change between linker
1722 versions.
1723
1724config HAVE_ARCH_PFN_VALID
1725 bool
1726
1727config ARCH_SUPPORTS_DEBUG_PAGEALLOC
1728 bool
1729
1730config ARCH_SUPPORTS_PAGE_TABLE_CHECK
1731 bool
1732
1733config ARCH_SPLIT_ARG64
1734 bool
1735 help
1736 If a 32-bit architecture requires 64-bit arguments to be split into
1737 pairs of 32-bit arguments, select this option.
1738
1739config ARCH_HAS_ELFCORE_COMPAT
1740 bool
1741
1742config ARCH_HAS_PARANOID_L1D_FLUSH
1743 bool
1744
1745config ARCH_HAVE_TRACE_MMIO_ACCESS
1746 bool
1747
1748config DYNAMIC_SIGFRAME
1749 bool
1750
1751# Select, if arch has a named attribute group bound to NUMA device nodes.
1752config HAVE_ARCH_NODE_DEV_GROUP
1753 bool
1754
1755config ARCH_HAS_HW_PTE_YOUNG
1756 bool
1757 help
1758 Architectures that select this option are capable of setting the
1759 accessed bit in PTE entries when using them as part of linear address
1760 translations. Architectures that require runtime check should select
1761 this option and override arch_has_hw_pte_young().
1762
1763config ARCH_HAS_NONLEAF_PMD_YOUNG
1764 bool
1765 help
1766 Architectures that select this option are capable of setting the
1767 accessed bit in non-leaf PMD entries when using them as part of linear
1768 address translations. Page table walkers that clear the accessed bit
1769 may use this capability to reduce their search space.
1770
1771config ARCH_HAS_KERNEL_FPU_SUPPORT
1772 bool
1773 help
1774 Architectures that select this option can run floating-point code in
1775 the kernel, as described in Documentation/core-api/floating-point.rst.
1776
1777config ARCH_VMLINUX_NEEDS_RELOCS
1778 bool
1779 help
1780 Whether the architecture needs vmlinux to be built with static
1781 relocations preserved. This is used by some architectures to
1782 construct bespoke relocation tables for KASLR.
1783
1784# Select if architecture uses the common generic TIF bits
1785config HAVE_GENERIC_TIF_BITS
1786 bool
1787
1788source "kernel/gcov/Kconfig"
1789
1790source "scripts/gcc-plugins/Kconfig"
1791
1792config FUNCTION_ALIGNMENT_4B
1793 bool
1794
1795config FUNCTION_ALIGNMENT_8B
1796 bool
1797
1798config FUNCTION_ALIGNMENT_16B
1799 bool
1800
1801config FUNCTION_ALIGNMENT_32B
1802 bool
1803
1804config FUNCTION_ALIGNMENT_64B
1805 bool
1806
1807config FUNCTION_ALIGNMENT
1808 int
1809 default 64 if FUNCTION_ALIGNMENT_64B
1810 default 32 if FUNCTION_ALIGNMENT_32B
1811 default 16 if FUNCTION_ALIGNMENT_16B
1812 default 8 if FUNCTION_ALIGNMENT_8B
1813 default 4 if FUNCTION_ALIGNMENT_4B
1814 default 0
1815
1816config CC_HAS_MIN_FUNCTION_ALIGNMENT
1817 # Detect availability of the GCC option -fmin-function-alignment which
1818 # guarantees minimal alignment for all functions, unlike
1819 # -falign-functions which the compiler ignores for cold functions.
1820 def_bool $(cc-option, -fmin-function-alignment=8)
1821
1822config CC_HAS_SANE_FUNCTION_ALIGNMENT
1823 # Set if the guaranteed alignment with -fmin-function-alignment is
1824 # available or extra care is required in the kernel. Clang provides
1825 # strict alignment always, even with -falign-functions.
1826 def_bool CC_HAS_MIN_FUNCTION_ALIGNMENT || CC_IS_CLANG
1827
1828config ARCH_NEED_CMPXCHG_1_EMU
1829 bool
1830
1831config ARCH_WANTS_PRE_LINK_VMLINUX
1832 bool
1833 help
1834 An architecture can select this if it provides arch/<arch>/tools/Makefile
1835 with .arch.vmlinux.o target to be linked into vmlinux.
1836
1837config ARCH_HAS_CPU_ATTACK_VECTORS
1838 bool
1839
1840config HAVE_ARCH_GET_SECUREBOOT
1841 def_bool EFI
1842
1843endmenu