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