Kconfig 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189
  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # General architecture dependent options
  4. #
  5. #
  6. # Note: arch/$(SRCARCH)/Kconfig needs to be included first so that it can
  7. # override the default values in this file.
  8. #
  9. source "arch/$(SRCARCH)/Kconfig"
  10. menu "General architecture-dependent options"
  11. config CRASH_CORE
  12. bool
  13. config KEXEC_CORE
  14. select CRASH_CORE
  15. bool
  16. config KEXEC_ELF
  17. bool
  18. config HAVE_IMA_KEXEC
  19. bool
  20. config SET_FS
  21. bool
  22. config HOTPLUG_SMT
  23. bool
  24. config GENERIC_ENTRY
  25. bool
  26. config OPROFILE
  27. tristate "OProfile system profiling"
  28. depends on PROFILING
  29. depends on HAVE_OPROFILE
  30. select RING_BUFFER
  31. select RING_BUFFER_ALLOW_SWAP
  32. help
  33. OProfile is a profiling system capable of profiling the
  34. whole system, include the kernel, kernel modules, libraries,
  35. and applications.
  36. If unsure, say N.
  37. config OPROFILE_EVENT_MULTIPLEX
  38. bool "OProfile multiplexing support (EXPERIMENTAL)"
  39. default n
  40. depends on OPROFILE && X86
  41. help
  42. The number of hardware counters is limited. The multiplexing
  43. feature enables OProfile to gather more events than counters
  44. are provided by the hardware. This is realized by switching
  45. between events at a user specified time interval.
  46. If unsure, say N.
  47. config HAVE_OPROFILE
  48. bool
  49. config OPROFILE_NMI_TIMER
  50. def_bool y
  51. depends on PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !PPC64
  52. config KPROBES
  53. bool "Kprobes"
  54. depends on MODULES
  55. depends on HAVE_KPROBES
  56. select KALLSYMS
  57. help
  58. Kprobes allows you to trap at almost any kernel address and
  59. execute a callback function. register_kprobe() establishes
  60. a probepoint and specifies the callback. Kprobes is useful
  61. for kernel debugging, non-intrusive instrumentation and testing.
  62. If in doubt, say "N".
  63. config JUMP_LABEL
  64. bool "Optimize very unlikely/likely branches"
  65. depends on HAVE_ARCH_JUMP_LABEL
  66. depends on CC_HAS_ASM_GOTO
  67. help
  68. This option enables a transparent branch optimization that
  69. makes certain almost-always-true or almost-always-false branch
  70. conditions even cheaper to execute within the kernel.
  71. Certain performance-sensitive kernel code, such as trace points,
  72. scheduler functionality, networking code and KVM have such
  73. branches and include support for this optimization technique.
  74. If it is detected that the compiler has support for "asm goto",
  75. the kernel will compile such branches with just a nop
  76. instruction. When the condition flag is toggled to true, the
  77. nop will be converted to a jump instruction to execute the
  78. conditional block of instructions.
  79. This technique lowers overhead and stress on the branch prediction
  80. of the processor and generally makes the kernel faster. The update
  81. of the condition is slower, but those are always very rare.
  82. ( On 32-bit x86, the necessary options added to the compiler
  83. flags may increase the size of the kernel slightly. )
  84. config STATIC_KEYS_SELFTEST
  85. bool "Static key selftest"
  86. depends on JUMP_LABEL
  87. help
  88. Boot time self-test of the branch patching code.
  89. config STATIC_CALL_SELFTEST
  90. bool "Static call selftest"
  91. depends on HAVE_STATIC_CALL
  92. help
  93. Boot time self-test of the call patching code.
  94. config OPTPROBES
  95. def_bool y
  96. depends on KPROBES && HAVE_OPTPROBES
  97. select TASKS_RCU if PREEMPTION
  98. config KPROBES_ON_FTRACE
  99. def_bool y
  100. depends on KPROBES && HAVE_KPROBES_ON_FTRACE
  101. depends on DYNAMIC_FTRACE_WITH_REGS
  102. help
  103. If function tracer is enabled and the arch supports full
  104. passing of pt_regs to function tracing, then kprobes can
  105. optimize on top of function tracing.
  106. config UPROBES
  107. def_bool n
  108. depends on ARCH_SUPPORTS_UPROBES
  109. help
  110. Uprobes is the user-space counterpart to kprobes: they
  111. enable instrumentation applications (such as 'perf probe')
  112. to establish unintrusive probes in user-space binaries and
  113. libraries, by executing handler functions when the probes
  114. are hit by user-space applications.
  115. ( These probes come in the form of single-byte breakpoints,
  116. managed by the kernel and kept transparent to the probed
  117. application. )
  118. config HAVE_64BIT_ALIGNED_ACCESS
  119. def_bool 64BIT && !HAVE_EFFICIENT_UNALIGNED_ACCESS
  120. help
  121. Some architectures require 64 bit accesses to be 64 bit
  122. aligned, which also requires structs containing 64 bit values
  123. to be 64 bit aligned too. This includes some 32 bit
  124. architectures which can do 64 bit accesses, as well as 64 bit
  125. architectures without unaligned access.
  126. This symbol should be selected by an architecture if 64 bit
  127. accesses are required to be 64 bit aligned in this way even
  128. though it is not a 64 bit architecture.
  129. See Documentation/unaligned-memory-access.txt for more
  130. information on the topic of unaligned memory accesses.
  131. config HAVE_EFFICIENT_UNALIGNED_ACCESS
  132. bool
  133. help
  134. Some architectures are unable to perform unaligned accesses
  135. without the use of get_unaligned/put_unaligned. Others are
  136. unable to perform such accesses efficiently (e.g. trap on
  137. unaligned access and require fixing it up in the exception
  138. handler.)
  139. This symbol should be selected by an architecture if it can
  140. perform unaligned accesses efficiently to allow different
  141. code paths to be selected for these cases. Some network
  142. drivers, for example, could opt to not fix up alignment
  143. problems with received packets if doing so would not help
  144. much.
  145. See Documentation/core-api/unaligned-memory-access.rst for more
  146. information on the topic of unaligned memory accesses.
  147. config ARCH_USE_BUILTIN_BSWAP
  148. bool
  149. help
  150. Modern versions of GCC (since 4.4) have builtin functions
  151. for handling byte-swapping. Using these, instead of the old
  152. inline assembler that the architecture code provides in the
  153. __arch_bswapXX() macros, allows the compiler to see what's
  154. happening and offers more opportunity for optimisation. In
  155. particular, the compiler will be able to combine the byteswap
  156. with a nearby load or store and use load-and-swap or
  157. store-and-swap instructions if the architecture has them. It
  158. should almost *never* result in code which is worse than the
  159. hand-coded assembler in <asm/swab.h>. But just in case it
  160. does, the use of the builtins is optional.
  161. Any architecture with load-and-swap or store-and-swap
  162. instructions should set this. And it shouldn't hurt to set it
  163. on architectures that don't have such instructions.
  164. config KRETPROBES
  165. def_bool y
  166. depends on KPROBES && HAVE_KRETPROBES
  167. config USER_RETURN_NOTIFIER
  168. bool
  169. depends on HAVE_USER_RETURN_NOTIFIER
  170. help
  171. Provide a kernel-internal notification when a cpu is about to
  172. switch to user mode.
  173. config HAVE_IOREMAP_PROT
  174. bool
  175. config HAVE_KPROBES
  176. bool
  177. config HAVE_KRETPROBES
  178. bool
  179. config HAVE_OPTPROBES
  180. bool
  181. config HAVE_KPROBES_ON_FTRACE
  182. bool
  183. config HAVE_FUNCTION_ERROR_INJECTION
  184. bool
  185. config HAVE_NMI
  186. bool
  187. #
  188. # An arch should select this if it provides all these things:
  189. #
  190. # task_pt_regs() in asm/processor.h or asm/ptrace.h
  191. # arch_has_single_step() if there is hardware single-step support
  192. # arch_has_block_step() if there is hardware block-step support
  193. # asm/syscall.h supplying asm-generic/syscall.h interface
  194. # linux/regset.h user_regset interfaces
  195. # CORE_DUMP_USE_REGSET #define'd in linux/elf.h
  196. # TIF_SYSCALL_TRACE calls tracehook_report_syscall_{entry,exit}
  197. # TIF_NOTIFY_RESUME calls tracehook_notify_resume()
  198. # signal delivery calls tracehook_signal_handler()
  199. #
  200. config HAVE_ARCH_TRACEHOOK
  201. bool
  202. config HAVE_DMA_CONTIGUOUS
  203. bool
  204. config GENERIC_SMP_IDLE_THREAD
  205. bool
  206. config GENERIC_IDLE_POLL_SETUP
  207. bool
  208. config ARCH_HAS_FORTIFY_SOURCE
  209. bool
  210. help
  211. An architecture should select this when it can successfully
  212. build and run with CONFIG_FORTIFY_SOURCE.
  213. #
  214. # Select if the arch provides a historic keepinit alias for the retain_initrd
  215. # command line option
  216. #
  217. config ARCH_HAS_KEEPINITRD
  218. bool
  219. # Select if arch has all set_memory_ro/rw/x/nx() functions in asm/cacheflush.h
  220. config ARCH_HAS_SET_MEMORY
  221. bool
  222. # Select if arch has all set_direct_map_invalid/default() functions
  223. config ARCH_HAS_SET_DIRECT_MAP
  224. bool
  225. #
  226. # Select if the architecture provides the arch_dma_set_uncached symbol to
  227. # either provide an uncached segement alias for a DMA allocation, or
  228. # to remap the page tables in place.
  229. #
  230. config ARCH_HAS_DMA_SET_UNCACHED
  231. bool
  232. #
  233. # Select if the architectures provides the arch_dma_clear_uncached symbol
  234. # to undo an in-place page table remap for uncached access.
  235. #
  236. config ARCH_HAS_DMA_CLEAR_UNCACHED
  237. bool
  238. # Select if arch init_task must go in the __init_task_data section
  239. config ARCH_TASK_STRUCT_ON_STACK
  240. bool
  241. # Select if arch has its private alloc_task_struct() function
  242. config ARCH_TASK_STRUCT_ALLOCATOR
  243. bool
  244. config HAVE_ARCH_THREAD_STRUCT_WHITELIST
  245. bool
  246. depends on !ARCH_TASK_STRUCT_ALLOCATOR
  247. help
  248. An architecture should select this to provide hardened usercopy
  249. knowledge about what region of the thread_struct should be
  250. whitelisted for copying to userspace. Normally this is only the
  251. FPU registers. Specifically, arch_thread_struct_whitelist()
  252. should be implemented. Without this, the entire thread_struct
  253. field in task_struct will be left whitelisted.
  254. # Select if arch has its private alloc_thread_stack() function
  255. config ARCH_THREAD_STACK_ALLOCATOR
  256. bool
  257. # Select if arch wants to size task_struct dynamically via arch_task_struct_size:
  258. config ARCH_WANTS_DYNAMIC_TASK_STRUCT
  259. bool
  260. config ARCH_32BIT_OFF_T
  261. bool
  262. depends on !64BIT
  263. help
  264. All new 32-bit architectures should have 64-bit off_t type on
  265. userspace side which corresponds to the loff_t kernel type. This
  266. is the requirement for modern ABIs. Some existing architectures
  267. still support 32-bit off_t. This option is enabled for all such
  268. architectures explicitly.
  269. config HAVE_ASM_MODVERSIONS
  270. bool
  271. help
  272. This symbol should be selected by an architecure if it provides
  273. <asm/asm-prototypes.h> to support the module versioning for symbols
  274. exported from assembly code.
  275. config HAVE_REGS_AND_STACK_ACCESS_API
  276. bool
  277. help
  278. This symbol should be selected by an architecure if it supports
  279. the API needed to access registers and stack entries from pt_regs,
  280. declared in asm/ptrace.h
  281. For example the kprobes-based event tracer needs this API.
  282. config HAVE_RSEQ
  283. bool
  284. depends on HAVE_REGS_AND_STACK_ACCESS_API
  285. help
  286. This symbol should be selected by an architecture if it
  287. supports an implementation of restartable sequences.
  288. config HAVE_FUNCTION_ARG_ACCESS_API
  289. bool
  290. help
  291. This symbol should be selected by an architecure if it supports
  292. the API needed to access function arguments from pt_regs,
  293. declared in asm/ptrace.h
  294. config HAVE_HW_BREAKPOINT
  295. bool
  296. depends on PERF_EVENTS
  297. config HAVE_MIXED_BREAKPOINTS_REGS
  298. bool
  299. depends on HAVE_HW_BREAKPOINT
  300. help
  301. Depending on the arch implementation of hardware breakpoints,
  302. some of them have separate registers for data and instruction
  303. breakpoints addresses, others have mixed registers to store
  304. them but define the access type in a control register.
  305. Select this option if your arch implements breakpoints under the
  306. latter fashion.
  307. config HAVE_USER_RETURN_NOTIFIER
  308. bool
  309. config HAVE_PERF_EVENTS_NMI
  310. bool
  311. help
  312. System hardware can generate an NMI using the perf event
  313. subsystem. Also has support for calculating CPU cycle events
  314. to determine how many clock cycles in a given period.
  315. config HAVE_HARDLOCKUP_DETECTOR_PERF
  316. bool
  317. depends on HAVE_PERF_EVENTS_NMI
  318. help
  319. The arch chooses to use the generic perf-NMI-based hardlockup
  320. detector. Must define HAVE_PERF_EVENTS_NMI.
  321. config HAVE_NMI_WATCHDOG
  322. depends on HAVE_NMI
  323. bool
  324. help
  325. The arch provides a low level NMI watchdog. It provides
  326. asm/nmi.h, and defines its own arch_touch_nmi_watchdog().
  327. config HAVE_HARDLOCKUP_DETECTOR_ARCH
  328. bool
  329. select HAVE_NMI_WATCHDOG
  330. help
  331. The arch chooses to provide its own hardlockup detector, which is
  332. a superset of the HAVE_NMI_WATCHDOG. It also conforms to config
  333. interfaces and parameters provided by hardlockup detector subsystem.
  334. config HAVE_PERF_REGS
  335. bool
  336. help
  337. Support selective register dumps for perf events. This includes
  338. bit-mapping of each registers and a unique architecture id.
  339. config HAVE_PERF_USER_STACK_DUMP
  340. bool
  341. help
  342. Support user stack dumps for perf event samples. This needs
  343. access to the user stack pointer which is not unified across
  344. architectures.
  345. config HAVE_ARCH_JUMP_LABEL
  346. bool
  347. config HAVE_ARCH_JUMP_LABEL_RELATIVE
  348. bool
  349. config MMU_GATHER_TABLE_FREE
  350. bool
  351. config MMU_GATHER_RCU_TABLE_FREE
  352. bool
  353. select MMU_GATHER_TABLE_FREE
  354. config MMU_GATHER_PAGE_SIZE
  355. bool
  356. config MMU_GATHER_NO_RANGE
  357. bool
  358. config MMU_GATHER_NO_GATHER
  359. bool
  360. depends on MMU_GATHER_TABLE_FREE
  361. config ARCH_WANT_IRQS_OFF_ACTIVATE_MM
  362. bool
  363. help
  364. Temporary select until all architectures can be converted to have
  365. irqs disabled over activate_mm. Architectures that do IPI based TLB
  366. shootdowns should enable this.
  367. config ARCH_HAVE_NMI_SAFE_CMPXCHG
  368. bool
  369. config HAVE_ALIGNED_STRUCT_PAGE
  370. bool
  371. help
  372. This makes sure that struct pages are double word aligned and that
  373. e.g. the SLUB allocator can perform double word atomic operations
  374. on a struct page for better performance. However selecting this
  375. might increase the size of a struct page by a word.
  376. config HAVE_CMPXCHG_LOCAL
  377. bool
  378. config HAVE_CMPXCHG_DOUBLE
  379. bool
  380. config ARCH_WEAK_RELEASE_ACQUIRE
  381. bool
  382. config ARCH_WANT_IPC_PARSE_VERSION
  383. bool
  384. config ARCH_WANT_COMPAT_IPC_PARSE_VERSION
  385. bool
  386. config ARCH_WANT_OLD_COMPAT_IPC
  387. select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
  388. bool
  389. config HAVE_ARCH_SECCOMP
  390. bool
  391. help
  392. An arch should select this symbol to support seccomp mode 1 (the fixed
  393. syscall policy), and must provide an overrides for __NR_seccomp_sigreturn,
  394. and compat syscalls if the asm-generic/seccomp.h defaults need adjustment:
  395. - __NR_seccomp_read_32
  396. - __NR_seccomp_write_32
  397. - __NR_seccomp_exit_32
  398. - __NR_seccomp_sigreturn_32
  399. config HAVE_ARCH_SECCOMP_FILTER
  400. bool
  401. select HAVE_ARCH_SECCOMP
  402. help
  403. An arch should select this symbol if it provides all of these things:
  404. - all the requirements for HAVE_ARCH_SECCOMP
  405. - syscall_get_arch()
  406. - syscall_get_arguments()
  407. - syscall_rollback()
  408. - syscall_set_return_value()
  409. - SIGSYS siginfo_t support
  410. - secure_computing is called from a ptrace_event()-safe context
  411. - secure_computing return value is checked and a return value of -1
  412. results in the system call being skipped immediately.
  413. - seccomp syscall wired up
  414. config SECCOMP
  415. prompt "Enable seccomp to safely execute untrusted bytecode"
  416. def_bool y
  417. depends on HAVE_ARCH_SECCOMP
  418. help
  419. This kernel feature is useful for number crunching applications
  420. that may need to handle untrusted bytecode during their
  421. execution. By using pipes or other transports made available
  422. to the process as file descriptors supporting the read/write
  423. syscalls, it's possible to isolate those applications in their
  424. own address space using seccomp. Once seccomp is enabled via
  425. prctl(PR_SET_SECCOMP) or the seccomp() syscall, it cannot be
  426. disabled and the task is only allowed to execute a few safe
  427. syscalls defined by each seccomp mode.
  428. If unsure, say Y.
  429. config SECCOMP_FILTER
  430. def_bool y
  431. depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET
  432. help
  433. Enable tasks to build secure computing environments defined
  434. in terms of Berkeley Packet Filter programs which implement
  435. task-defined system call filtering polices.
  436. See Documentation/userspace-api/seccomp_filter.rst for details.
  437. config HAVE_ARCH_STACKLEAK
  438. bool
  439. help
  440. An architecture should select this if it has the code which
  441. fills the used part of the kernel stack with the STACKLEAK_POISON
  442. value before returning from system calls.
  443. config HAVE_STACKPROTECTOR
  444. bool
  445. help
  446. An arch should select this symbol if:
  447. - it has implemented a stack canary (e.g. __stack_chk_guard)
  448. config STACKPROTECTOR
  449. bool "Stack Protector buffer overflow detection"
  450. depends on HAVE_STACKPROTECTOR
  451. depends on $(cc-option,-fstack-protector)
  452. default y
  453. help
  454. This option turns on the "stack-protector" GCC feature. This
  455. feature puts, at the beginning of functions, a canary value on
  456. the stack just before the return address, and validates
  457. the value just before actually returning. Stack based buffer
  458. overflows (that need to overwrite this return address) now also
  459. overwrite the canary, which gets detected and the attack is then
  460. neutralized via a kernel panic.
  461. Functions will have the stack-protector canary logic added if they
  462. have an 8-byte or larger character array on the stack.
  463. This feature requires gcc version 4.2 or above, or a distribution
  464. gcc with the feature backported ("-fstack-protector").
  465. On an x86 "defconfig" build, this feature adds canary checks to
  466. about 3% of all kernel functions, which increases kernel code size
  467. by about 0.3%.
  468. config STACKPROTECTOR_STRONG
  469. bool "Strong Stack Protector"
  470. depends on STACKPROTECTOR
  471. depends on $(cc-option,-fstack-protector-strong)
  472. default y
  473. help
  474. Functions will have the stack-protector canary logic added in any
  475. of the following conditions:
  476. - local variable's address used as part of the right hand side of an
  477. assignment or function argument
  478. - local variable is an array (or union containing an array),
  479. regardless of array type or length
  480. - uses register local variables
  481. This feature requires gcc version 4.9 or above, or a distribution
  482. gcc with the feature backported ("-fstack-protector-strong").
  483. On an x86 "defconfig" build, this feature adds canary checks to
  484. about 20% of all kernel functions, which increases the kernel code
  485. size by about 2%.
  486. config ARCH_SUPPORTS_SHADOW_CALL_STACK
  487. bool
  488. help
  489. An architecture should select this if it supports Clang's Shadow
  490. Call Stack and implements runtime support for shadow stack
  491. switching.
  492. config SHADOW_CALL_STACK
  493. bool "Clang Shadow Call Stack"
  494. depends on CC_IS_CLANG && ARCH_SUPPORTS_SHADOW_CALL_STACK
  495. depends on DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER
  496. help
  497. This option enables Clang's Shadow Call Stack, which uses a
  498. shadow stack to protect function return addresses from being
  499. overwritten by an attacker. More information can be found in
  500. Clang's documentation:
  501. https://clang.llvm.org/docs/ShadowCallStack.html
  502. Note that security guarantees in the kernel differ from the
  503. ones documented for user space. The kernel must store addresses
  504. of shadow stacks in memory, which means an attacker capable of
  505. reading and writing arbitrary memory may be able to locate them
  506. and hijack control flow by modifying the stacks.
  507. config LTO
  508. bool
  509. help
  510. Selected if the kernel will be built using the compiler's LTO feature.
  511. config LTO_CLANG
  512. bool
  513. select LTO
  514. help
  515. Selected if the kernel will be built using Clang's LTO feature.
  516. config ARCH_SUPPORTS_LTO_CLANG
  517. bool
  518. help
  519. An architecture should select this option if it supports:
  520. - compiling with Clang,
  521. - compiling inline assembly with Clang's integrated assembler,
  522. - and linking with LLD.
  523. config ARCH_SUPPORTS_LTO_CLANG_THIN
  524. bool
  525. help
  526. An architecture should select this option if it can support Clang's
  527. ThinLTO mode.
  528. config HAS_LTO_CLANG
  529. def_bool y
  530. # Clang >= 11: https://github.com/ClangBuiltLinux/linux/issues/510
  531. depends on CC_IS_CLANG && CLANG_VERSION >= 110000 && LD_IS_LLD
  532. depends on $(success,test $(LLVM) -eq 1)
  533. depends on $(success,test $(LLVM_IAS) -eq 1)
  534. depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm)
  535. depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm)
  536. depends on ARCH_SUPPORTS_LTO_CLANG
  537. depends on !FTRACE_MCOUNT_USE_RECORDMCOUNT
  538. depends on !KASAN || KASAN_HW_TAGS
  539. depends on !GCOV_KERNEL
  540. help
  541. The compiler and Kconfig options support building with Clang's
  542. LTO.
  543. choice
  544. prompt "Link Time Optimization (LTO)"
  545. default LTO_NONE
  546. help
  547. This option enables Link Time Optimization (LTO), which allows the
  548. compiler to optimize binaries globally.
  549. If unsure, select LTO_NONE. Note that LTO is very resource-intensive
  550. so it's disabled by default.
  551. config LTO_NONE
  552. bool "None"
  553. help
  554. Build the kernel normally, without Link Time Optimization (LTO).
  555. config LTO_CLANG_FULL
  556. bool "Clang Full LTO (EXPERIMENTAL)"
  557. depends on HAS_LTO_CLANG
  558. depends on !COMPILE_TEST
  559. select LTO_CLANG
  560. help
  561. This option enables Clang's full Link Time Optimization (LTO), which
  562. allows the compiler to optimize the kernel globally. If you enable
  563. this option, the compiler generates LLVM bitcode instead of ELF
  564. object files, and the actual compilation from bitcode happens at
  565. the LTO link step, which may take several minutes depending on the
  566. kernel configuration. More information can be found from LLVM's
  567. documentation:
  568. https://llvm.org/docs/LinkTimeOptimization.html
  569. During link time, this option can use a large amount of RAM, and
  570. may take much longer than the ThinLTO option.
  571. config LTO_CLANG_THIN
  572. bool "Clang ThinLTO (EXPERIMENTAL)"
  573. depends on HAS_LTO_CLANG && ARCH_SUPPORTS_LTO_CLANG_THIN
  574. select LTO_CLANG
  575. help
  576. This option enables Clang's ThinLTO, which allows for parallel
  577. optimization and faster incremental compiles compared to the
  578. CONFIG_LTO_CLANG_FULL option. More information can be found
  579. from Clang's documentation:
  580. https://clang.llvm.org/docs/ThinLTO.html
  581. If unsure, say Y.
  582. endchoice
  583. config CFI_CLANG
  584. bool "Use Clang's Control Flow Integrity (CFI)"
  585. depends on LTO_CLANG && KALLSYMS
  586. help
  587. This option enables Clang's Control Flow Integrity (CFI), which adds
  588. runtime checking for indirect function calls.
  589. config CFI_CLANG_SHADOW
  590. bool "Use CFI shadow to speed up cross-module checks"
  591. default y
  592. depends on CFI_CLANG && MODULES
  593. help
  594. If you select this option, the kernel builds a fast look-up table of
  595. CFI check functions in loaded modules to reduce overhead.
  596. config CFI_PERMISSIVE
  597. bool "Use CFI in permissive mode"
  598. depends on CFI_CLANG
  599. help
  600. When selected, Control Flow Integrity (CFI) violations result in a
  601. warning instead of a kernel panic. This option is useful for finding
  602. CFI violations during development.
  603. config HAVE_ARCH_WITHIN_STACK_FRAMES
  604. bool
  605. help
  606. An architecture should select this if it can walk the kernel stack
  607. frames to determine if an object is part of either the arguments
  608. or local variables (i.e. that it excludes saved return addresses,
  609. and similar) by implementing an inline arch_within_stack_frames(),
  610. which is used by CONFIG_HARDENED_USERCOPY.
  611. config HAVE_CONTEXT_TRACKING
  612. bool
  613. help
  614. Provide kernel/user boundaries probes necessary for subsystems
  615. that need it, such as userspace RCU extended quiescent state.
  616. Syscalls need to be wrapped inside user_exit()-user_enter(), either
  617. optimized behind static key or through the slow path using TIF_NOHZ
  618. flag. Exceptions handlers must be wrapped as well. Irqs are already
  619. protected inside rcu_irq_enter/rcu_irq_exit() but preemption or signal
  620. handling on irq exit still need to be protected.
  621. config HAVE_TIF_NOHZ
  622. bool
  623. help
  624. Arch relies on TIF_NOHZ and syscall slow path to implement context
  625. tracking calls to user_enter()/user_exit().
  626. config HAVE_VIRT_CPU_ACCOUNTING
  627. bool
  628. config ARCH_HAS_SCALED_CPUTIME
  629. bool
  630. config HAVE_VIRT_CPU_ACCOUNTING_GEN
  631. bool
  632. default y if 64BIT
  633. help
  634. With VIRT_CPU_ACCOUNTING_GEN, cputime_t becomes 64-bit.
  635. Before enabling this option, arch code must be audited
  636. to ensure there are no races in concurrent read/write of
  637. cputime_t. For example, reading/writing 64-bit cputime_t on
  638. some 32-bit arches may require multiple accesses, so proper
  639. locking is needed to protect against concurrent accesses.
  640. config HAVE_IRQ_TIME_ACCOUNTING
  641. bool
  642. help
  643. Archs need to ensure they use a high enough resolution clock to
  644. support irq time accounting and then call enable_sched_clock_irqtime().
  645. config HAVE_MOVE_PUD
  646. bool
  647. help
  648. Architectures that select this are able to move page tables at the
  649. PUD level. If there are only 3 page table levels, the move effectively
  650. happens at the PGD level.
  651. config HAVE_MOVE_PMD
  652. bool
  653. help
  654. Archs that select this are able to move page tables at the PMD level.
  655. config HAVE_ARCH_TRANSPARENT_HUGEPAGE
  656. bool
  657. config HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
  658. bool
  659. config HAVE_ARCH_HUGE_VMAP
  660. bool
  661. config ARCH_WANT_HUGE_PMD_SHARE
  662. bool
  663. config HAVE_ARCH_SOFT_DIRTY
  664. bool
  665. config HAVE_MOD_ARCH_SPECIFIC
  666. bool
  667. help
  668. The arch uses struct mod_arch_specific to store data. Many arches
  669. just need a simple module loader without arch specific data - those
  670. should not enable this.
  671. config MODULES_USE_ELF_RELA
  672. bool
  673. help
  674. Modules only use ELF RELA relocations. Modules with ELF REL
  675. relocations will give an error.
  676. config MODULES_USE_ELF_REL
  677. bool
  678. help
  679. Modules only use ELF REL relocations. Modules with ELF RELA
  680. relocations will give an error.
  681. config HAVE_IRQ_EXIT_ON_IRQ_STACK
  682. bool
  683. help
  684. Architecture doesn't only execute the irq handler on the irq stack
  685. but also irq_exit(). This way we can process softirqs on this irq
  686. stack instead of switching to a new one when we call __do_softirq()
  687. in the end of an hardirq.
  688. This spares a stack switch and improves cache usage on softirq
  689. processing.
  690. config PGTABLE_LEVELS
  691. int
  692. default 2
  693. config ARCH_HAS_ELF_RANDOMIZE
  694. bool
  695. help
  696. An architecture supports choosing randomized locations for
  697. stack, mmap, brk, and ET_DYN. Defined functions:
  698. - arch_mmap_rnd()
  699. - arch_randomize_brk()
  700. config HAVE_ARCH_MMAP_RND_BITS
  701. bool
  702. help
  703. An arch should select this symbol if it supports setting a variable
  704. number of bits for use in establishing the base address for mmap
  705. allocations, has MMU enabled and provides values for both:
  706. - ARCH_MMAP_RND_BITS_MIN
  707. - ARCH_MMAP_RND_BITS_MAX
  708. config HAVE_EXIT_THREAD
  709. bool
  710. help
  711. An architecture implements exit_thread.
  712. config ARCH_MMAP_RND_BITS_MIN
  713. int
  714. config ARCH_MMAP_RND_BITS_MAX
  715. int
  716. config ARCH_MMAP_RND_BITS_DEFAULT
  717. int
  718. config ARCH_MMAP_RND_BITS
  719. int "Number of bits to use for ASLR of mmap base address" if EXPERT
  720. range ARCH_MMAP_RND_BITS_MIN ARCH_MMAP_RND_BITS_MAX
  721. default ARCH_MMAP_RND_BITS_DEFAULT if ARCH_MMAP_RND_BITS_DEFAULT
  722. default ARCH_MMAP_RND_BITS_MIN
  723. depends on HAVE_ARCH_MMAP_RND_BITS
  724. help
  725. This value can be used to select the number of bits to use to
  726. determine the random offset to the base address of vma regions
  727. resulting from mmap allocations. This value will be bounded
  728. by the architecture's minimum and maximum supported values.
  729. This value can be changed after boot using the
  730. /proc/sys/vm/mmap_rnd_bits tunable
  731. config HAVE_ARCH_MMAP_RND_COMPAT_BITS
  732. bool
  733. help
  734. An arch should select this symbol if it supports running applications
  735. in compatibility mode, supports setting a variable number of bits for
  736. use in establishing the base address for mmap allocations, has MMU
  737. enabled and provides values for both:
  738. - ARCH_MMAP_RND_COMPAT_BITS_MIN
  739. - ARCH_MMAP_RND_COMPAT_BITS_MAX
  740. config ARCH_MMAP_RND_COMPAT_BITS_MIN
  741. int
  742. config ARCH_MMAP_RND_COMPAT_BITS_MAX
  743. int
  744. config ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
  745. int
  746. config ARCH_MMAP_RND_COMPAT_BITS
  747. int "Number of bits to use for ASLR of mmap base address for compatible applications" if EXPERT
  748. range ARCH_MMAP_RND_COMPAT_BITS_MIN ARCH_MMAP_RND_COMPAT_BITS_MAX
  749. default ARCH_MMAP_RND_COMPAT_BITS_DEFAULT if ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
  750. default ARCH_MMAP_RND_COMPAT_BITS_MIN
  751. depends on HAVE_ARCH_MMAP_RND_COMPAT_BITS
  752. help
  753. This value can be used to select the number of bits to use to
  754. determine the random offset to the base address of vma regions
  755. resulting from mmap allocations for compatible applications This
  756. value will be bounded by the architecture's minimum and maximum
  757. supported values.
  758. This value can be changed after boot using the
  759. /proc/sys/vm/mmap_rnd_compat_bits tunable
  760. config HAVE_ARCH_COMPAT_MMAP_BASES
  761. bool
  762. help
  763. This allows 64bit applications to invoke 32-bit mmap() syscall
  764. and vice-versa 32-bit applications to call 64-bit mmap().
  765. Required for applications doing different bitness syscalls.
  766. # This allows to use a set of generic functions to determine mmap base
  767. # address by giving priority to top-down scheme only if the process
  768. # is not in legacy mode (compat task, unlimited stack size or
  769. # sysctl_legacy_va_layout).
  770. # Architecture that selects this option can provide its own version of:
  771. # - STACK_RND_MASK
  772. config ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
  773. bool
  774. depends on MMU
  775. select ARCH_HAS_ELF_RANDOMIZE
  776. config HAVE_STACK_VALIDATION
  777. bool
  778. help
  779. Architecture supports the 'objtool check' host tool command, which
  780. performs compile-time stack metadata validation.
  781. config HAVE_RELIABLE_STACKTRACE
  782. bool
  783. help
  784. Architecture has either save_stack_trace_tsk_reliable() or
  785. arch_stack_walk_reliable() function which only returns a stack trace
  786. if it can guarantee the trace is reliable.
  787. config HAVE_ARCH_HASH
  788. bool
  789. default n
  790. help
  791. If this is set, the architecture provides an <asm/hash.h>
  792. file which provides platform-specific implementations of some
  793. functions in <linux/hash.h> or fs/namei.c.
  794. config HAVE_ARCH_NVRAM_OPS
  795. bool
  796. config ISA_BUS_API
  797. def_bool ISA
  798. #
  799. # ABI hall of shame
  800. #
  801. config CLONE_BACKWARDS
  802. bool
  803. help
  804. Architecture has tls passed as the 4th argument of clone(2),
  805. not the 5th one.
  806. config CLONE_BACKWARDS2
  807. bool
  808. help
  809. Architecture has the first two arguments of clone(2) swapped.
  810. config CLONE_BACKWARDS3
  811. bool
  812. help
  813. Architecture has tls passed as the 3rd argument of clone(2),
  814. not the 5th one.
  815. config ODD_RT_SIGACTION
  816. bool
  817. help
  818. Architecture has unusual rt_sigaction(2) arguments
  819. config OLD_SIGSUSPEND
  820. bool
  821. help
  822. Architecture has old sigsuspend(2) syscall, of one-argument variety
  823. config OLD_SIGSUSPEND3
  824. bool
  825. help
  826. Even weirder antique ABI - three-argument sigsuspend(2)
  827. config OLD_SIGACTION
  828. bool
  829. help
  830. Architecture has old sigaction(2) syscall. Nope, not the same
  831. as OLD_SIGSUSPEND | OLD_SIGSUSPEND3 - alpha has sigsuspend(2),
  832. but fairly different variant of sigaction(2), thanks to OSF/1
  833. compatibility...
  834. config COMPAT_OLD_SIGACTION
  835. bool
  836. config COMPAT_32BIT_TIME
  837. bool "Provide system calls for 32-bit time_t"
  838. default !64BIT || COMPAT
  839. help
  840. This enables 32 bit time_t support in addition to 64 bit time_t support.
  841. This is relevant on all 32-bit architectures, and 64-bit architectures
  842. as part of compat syscall handling.
  843. config ARCH_NO_PREEMPT
  844. bool
  845. config ARCH_SUPPORTS_RT
  846. bool
  847. config CPU_NO_EFFICIENT_FFS
  848. def_bool n
  849. config HAVE_ARCH_VMAP_STACK
  850. def_bool n
  851. help
  852. An arch should select this symbol if it can support kernel stacks
  853. in vmalloc space. This means:
  854. - vmalloc space must be large enough to hold many kernel stacks.
  855. This may rule out many 32-bit architectures.
  856. - Stacks in vmalloc space need to work reliably. For example, if
  857. vmap page tables are created on demand, either this mechanism
  858. needs to work while the stack points to a virtual address with
  859. unpopulated page tables or arch code (switch_to() and switch_mm(),
  860. most likely) needs to ensure that the stack's page table entries
  861. are populated before running on a possibly unpopulated stack.
  862. - If the stack overflows into a guard page, something reasonable
  863. should happen. The definition of "reasonable" is flexible, but
  864. instantly rebooting without logging anything would be unfriendly.
  865. config VMAP_STACK
  866. default y
  867. bool "Use a virtually-mapped stack"
  868. depends on HAVE_ARCH_VMAP_STACK
  869. depends on !KASAN || KASAN_HW_TAGS || KASAN_VMALLOC
  870. help
  871. Enable this if you want the use virtually-mapped kernel stacks
  872. with guard pages. This causes kernel stack overflows to be
  873. caught immediately rather than causing difficult-to-diagnose
  874. corruption.
  875. To use this with software KASAN modes, the architecture must support
  876. backing virtual mappings with real shadow memory, and KASAN_VMALLOC
  877. must be enabled.
  878. config ARCH_OPTIONAL_KERNEL_RWX
  879. def_bool n
  880. config ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
  881. def_bool n
  882. config ARCH_HAS_STRICT_KERNEL_RWX
  883. def_bool n
  884. config STRICT_KERNEL_RWX
  885. bool "Make kernel text and rodata read-only" if ARCH_OPTIONAL_KERNEL_RWX
  886. depends on ARCH_HAS_STRICT_KERNEL_RWX
  887. default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
  888. help
  889. If this is set, kernel text and rodata memory will be made read-only,
  890. and non-text memory will be made non-executable. This provides
  891. protection against certain security exploits (e.g. executing the heap
  892. or modifying text)
  893. These features are considered standard security practice these days.
  894. You should say Y here in almost all cases.
  895. config ARCH_HAS_STRICT_MODULE_RWX
  896. def_bool n
  897. config STRICT_MODULE_RWX
  898. bool "Set loadable kernel module data as NX and text as RO" if ARCH_OPTIONAL_KERNEL_RWX
  899. depends on ARCH_HAS_STRICT_MODULE_RWX && MODULES
  900. default !ARCH_OPTIONAL_KERNEL_RWX || ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
  901. help
  902. If this is set, module text and rodata memory will be made read-only,
  903. and non-text memory will be made non-executable. This provides
  904. protection against certain security exploits (e.g. writing to text)
  905. # select if the architecture provides an asm/dma-direct.h header
  906. config ARCH_HAS_PHYS_TO_DMA
  907. bool
  908. config HAVE_ARCH_COMPILER_H
  909. bool
  910. help
  911. An architecture can select this if it provides an
  912. asm/compiler.h header that should be included after
  913. linux/compiler-*.h in order to override macro definitions that those
  914. headers generally provide.
  915. config HAVE_ARCH_PREL32_RELOCATIONS
  916. bool
  917. help
  918. May be selected by an architecture if it supports place-relative
  919. 32-bit relocations, both in the toolchain and in the module loader,
  920. in which case relative references can be used in special sections
  921. for PCI fixup, initcalls etc which are only half the size on 64 bit
  922. architectures, and don't require runtime relocation on relocatable
  923. kernels.
  924. config ARCH_USE_MEMREMAP_PROT
  925. bool
  926. config LOCK_EVENT_COUNTS
  927. bool "Locking event counts collection"
  928. depends on DEBUG_FS
  929. help
  930. Enable light-weight counting of various locking related events
  931. in the system with minimal performance impact. This reduces
  932. the chance of application behavior change because of timing
  933. differences. The counts are reported via debugfs.
  934. # Select if the architecture has support for applying RELR relocations.
  935. config ARCH_HAS_RELR
  936. bool
  937. config RELR
  938. bool "Use RELR relocation packing"
  939. depends on ARCH_HAS_RELR && TOOLS_SUPPORT_RELR
  940. default y
  941. help
  942. Store the kernel's dynamic relocations in the RELR relocation packing
  943. format. Requires a compatible linker (LLD supports this feature), as
  944. well as compatible NM and OBJCOPY utilities (llvm-nm and llvm-objcopy
  945. are compatible).
  946. config ARCH_HAS_MEM_ENCRYPT
  947. bool
  948. config ARCH_HAS_CC_PLATFORM
  949. bool
  950. config HAVE_SPARSE_SYSCALL_NR
  951. bool
  952. help
  953. An architecture should select this if its syscall numbering is sparse
  954. to save space. For example, MIPS architecture has a syscall array with
  955. entries at 4000, 5000 and 6000 locations. This option turns on syscall
  956. related optimizations for a given architecture.
  957. config ARCH_HAS_VDSO_DATA
  958. bool
  959. config HAVE_STATIC_CALL
  960. bool
  961. config HAVE_STATIC_CALL_INLINE
  962. bool
  963. depends on HAVE_STATIC_CALL
  964. config ARCH_WANT_LD_ORPHAN_WARN
  965. bool
  966. help
  967. An arch should select this symbol once all linker sections are explicitly
  968. included, size-asserted, or discarded in the linker scripts. This is
  969. important because we never want expected sections to be placed heuristically
  970. by the linker, since the locations of such sections can change between linker
  971. versions.
  972. config ARCH_SPLIT_ARG64
  973. bool
  974. help
  975. If a 32-bit architecture requires 64-bit arguments to be split into
  976. pairs of 32-bit arguments, select this option.
  977. source "kernel/gcov/Kconfig"
  978. source "scripts/gcc-plugins/Kconfig"
  979. endmenu