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