Kconfig 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Security configuration
  4. #
  5. menu "Security options"
  6. source "security/keys/Kconfig"
  7. config SECURITY_DMESG_RESTRICT
  8. bool "Restrict unprivileged access to the kernel syslog"
  9. default n
  10. help
  11. This enforces restrictions on unprivileged users reading the kernel
  12. syslog via dmesg(8).
  13. If this option is not selected, no restrictions will be enforced
  14. unless the dmesg_restrict sysctl is explicitly set to (1).
  15. If you are unsure how to answer this question, answer N.
  16. config SECURITY
  17. bool "Enable different security models"
  18. depends on SYSFS
  19. depends on MULTIUSER
  20. help
  21. This allows you to choose different security modules to be
  22. configured into your kernel.
  23. If this option is not selected, the default Linux security
  24. model will be used.
  25. If you are unsure how to answer this question, answer N.
  26. config SECURITY_WRITABLE_HOOKS
  27. depends on SECURITY
  28. bool
  29. default n
  30. config SECURITYFS
  31. bool "Enable the securityfs filesystem"
  32. help
  33. This will build the securityfs filesystem. It is currently used by
  34. various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM).
  35. If you are unsure how to answer this question, answer N.
  36. config SECURITY_NETWORK
  37. bool "Socket and Networking Security Hooks"
  38. depends on SECURITY
  39. help
  40. This enables the socket and networking security hooks.
  41. If enabled, a security module can use these hooks to
  42. implement socket and networking access controls.
  43. If you are unsure how to answer this question, answer N.
  44. config SECURITY_INFINIBAND
  45. bool "Infiniband Security Hooks"
  46. depends on SECURITY && INFINIBAND
  47. help
  48. This enables the Infiniband security hooks.
  49. If enabled, a security module can use these hooks to
  50. implement Infiniband access controls.
  51. If you are unsure how to answer this question, answer N.
  52. config SECURITY_NETWORK_XFRM
  53. bool "XFRM (IPSec) Networking Security Hooks"
  54. depends on XFRM && SECURITY_NETWORK
  55. help
  56. This enables the XFRM (IPSec) networking security hooks.
  57. If enabled, a security module can use these hooks to
  58. implement per-packet access controls based on labels
  59. derived from IPSec policy. Non-IPSec communications are
  60. designated as unlabelled, and only sockets authorized
  61. to communicate unlabelled data can send without using
  62. IPSec.
  63. If you are unsure how to answer this question, answer N.
  64. config SECURITY_PATH
  65. bool "Security hooks for pathname based access control"
  66. depends on SECURITY
  67. help
  68. This enables the security hooks for pathname based access control.
  69. If enabled, a security module can use these hooks to
  70. implement pathname based access controls.
  71. If you are unsure how to answer this question, answer N.
  72. config INTEL_TXT
  73. bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
  74. depends on HAVE_INTEL_TXT
  75. help
  76. This option enables support for booting the kernel with the
  77. Trusted Boot (tboot) module. This will utilize
  78. Intel(R) Trusted Execution Technology to perform a measured launch
  79. of the kernel. If the system does not support Intel(R) TXT, this
  80. will have no effect.
  81. Intel TXT will provide higher assurance of system configuration and
  82. initial state as well as data reset protection. This is used to
  83. create a robust initial kernel measurement and verification, which
  84. helps to ensure that kernel security mechanisms are functioning
  85. correctly. This level of protection requires a root of trust outside
  86. of the kernel itself.
  87. Intel TXT also helps solve real end user concerns about having
  88. confidence that their hardware is running the VMM or kernel that
  89. it was configured with, especially since they may be responsible for
  90. providing such assurances to VMs and services running on it.
  91. See <https://www.intel.com/technology/security/> for more information
  92. about Intel(R) TXT.
  93. See <http://tboot.sourceforge.net> for more information about tboot.
  94. See Documentation/x86/intel_txt.rst for a description of how to enable
  95. Intel TXT support in a kernel boot.
  96. If you are unsure as to whether this is required, answer N.
  97. config LSM_MMAP_MIN_ADDR
  98. int "Low address space for LSM to protect from user allocation"
  99. depends on SECURITY && SECURITY_SELINUX
  100. default 32768 if ARM || (ARM64 && COMPAT)
  101. default 65536
  102. help
  103. This is the portion of low virtual memory which should be protected
  104. from userspace allocation. Keeping a user from writing to low pages
  105. can help reduce the impact of kernel NULL pointer bugs.
  106. For most ia64, ppc64 and x86 users with lots of address space
  107. a value of 65536 is reasonable and should cause no problems.
  108. On arm and other archs it should not be higher than 32768.
  109. Programs which use vm86 functionality or have some need to map
  110. this low address space will need the permission specific to the
  111. systems running LSM.
  112. config HAVE_HARDENED_USERCOPY_ALLOCATOR
  113. bool
  114. help
  115. The heap allocator implements __check_heap_object() for
  116. validating memory ranges against heap object sizes in
  117. support of CONFIG_HARDENED_USERCOPY.
  118. config HARDENED_USERCOPY
  119. bool "Harden memory copies between kernel and userspace"
  120. depends on HAVE_HARDENED_USERCOPY_ALLOCATOR
  121. imply STRICT_DEVMEM
  122. help
  123. This option checks for obviously wrong memory regions when
  124. copying memory to/from the kernel (via copy_to_user() and
  125. copy_from_user() functions) by rejecting memory ranges that
  126. are larger than the specified heap object, span multiple
  127. separately allocated pages, are not on the process stack,
  128. or are part of the kernel text. This prevents entire classes
  129. of heap overflow exploits and similar kernel memory exposures.
  130. config FORTIFY_SOURCE
  131. bool "Harden common str/mem functions against buffer overflows"
  132. depends on ARCH_HAS_FORTIFY_SOURCE
  133. # https://bugs.llvm.org/show_bug.cgi?id=41459
  134. depends on !CC_IS_CLANG || CLANG_VERSION >= 120001
  135. # https://github.com/llvm/llvm-project/issues/53645
  136. depends on !CC_IS_CLANG || !X86_32
  137. help
  138. Detect overflows of buffers in common string and memory functions
  139. where the compiler can determine and validate the buffer sizes.
  140. config STATIC_USERMODEHELPER
  141. bool "Force all usermode helper calls through a single binary"
  142. help
  143. By default, the kernel can call many different userspace
  144. binary programs through the "usermode helper" kernel
  145. interface. Some of these binaries are statically defined
  146. either in the kernel code itself, or as a kernel configuration
  147. option. However, some of these are dynamically created at
  148. runtime, or can be modified after the kernel has started up.
  149. To provide an additional layer of security, route all of these
  150. calls through a single executable that can not have its name
  151. changed.
  152. Note, it is up to this single binary to then call the relevant
  153. "real" usermode helper binary, based on the first argument
  154. passed to it. If desired, this program can filter and pick
  155. and choose what real programs are called.
  156. If you wish for all usermode helper programs are to be
  157. disabled, choose this option and then set
  158. STATIC_USERMODEHELPER_PATH to an empty string.
  159. config STATIC_USERMODEHELPER_PATH
  160. string "Path to the static usermode helper binary"
  161. depends on STATIC_USERMODEHELPER
  162. default "/sbin/usermode-helper"
  163. help
  164. The binary called by the kernel when any usermode helper
  165. program is wish to be run. The "real" application's name will
  166. be in the first argument passed to this program on the command
  167. line.
  168. If you wish for all usermode helper programs to be disabled,
  169. specify an empty string here (i.e. "").
  170. source "security/selinux/Kconfig"
  171. source "security/smack/Kconfig"
  172. source "security/tomoyo/Kconfig"
  173. source "security/apparmor/Kconfig"
  174. source "security/loadpin/Kconfig"
  175. source "security/yama/Kconfig"
  176. source "security/safesetid/Kconfig"
  177. source "security/lockdown/Kconfig"
  178. source "security/landlock/Kconfig"
  179. source "security/integrity/Kconfig"
  180. choice
  181. prompt "First legacy 'major LSM' to be initialized"
  182. default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX
  183. default DEFAULT_SECURITY_SMACK if SECURITY_SMACK
  184. default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO
  185. default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR
  186. default DEFAULT_SECURITY_DAC
  187. help
  188. This choice is there only for converting CONFIG_DEFAULT_SECURITY
  189. in old kernel configs to CONFIG_LSM in new kernel configs. Don't
  190. change this choice unless you are creating a fresh kernel config,
  191. for this choice will be ignored after CONFIG_LSM has been set.
  192. Selects the legacy "major security module" that will be
  193. initialized first. Overridden by non-default CONFIG_LSM.
  194. config DEFAULT_SECURITY_SELINUX
  195. bool "SELinux" if SECURITY_SELINUX=y
  196. config DEFAULT_SECURITY_SMACK
  197. bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y
  198. config DEFAULT_SECURITY_TOMOYO
  199. bool "TOMOYO" if SECURITY_TOMOYO=y
  200. config DEFAULT_SECURITY_APPARMOR
  201. bool "AppArmor" if SECURITY_APPARMOR=y
  202. config DEFAULT_SECURITY_DAC
  203. bool "Unix Discretionary Access Controls"
  204. endchoice
  205. config LSM
  206. string "Ordered list of enabled LSMs"
  207. default "landlock,lockdown,yama,loadpin,safesetid,integrity,smack,selinux,tomoyo,apparmor,bpf" if DEFAULT_SECURITY_SMACK
  208. default "landlock,lockdown,yama,loadpin,safesetid,integrity,apparmor,selinux,smack,tomoyo,bpf" if DEFAULT_SECURITY_APPARMOR
  209. default "landlock,lockdown,yama,loadpin,safesetid,integrity,tomoyo,bpf" if DEFAULT_SECURITY_TOMOYO
  210. default "landlock,lockdown,yama,loadpin,safesetid,integrity,bpf" if DEFAULT_SECURITY_DAC
  211. default "landlock,lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor,bpf"
  212. help
  213. A comma-separated list of LSMs, in initialization order.
  214. Any LSMs left off this list will be ignored. This can be
  215. controlled at boot with the "lsm=" parameter.
  216. If unsure, leave this as the default.
  217. config DDAR_KEY_DUMP
  218. bool "DDAR KEY DUMP"
  219. default n
  220. help
  221. For dumping sensitive keying material for CC Certification test.
  222. Enabled only for eng and userdebug builds.
  223. source "security/Kconfig.hardening"
  224. endmenu