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