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