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