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