18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci# 38c2ecf20Sopenharmony_ci# Security configuration 48c2ecf20Sopenharmony_ci# 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_cimenu "Security options" 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_cisource "security/keys/Kconfig" 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciconfig SECURITY_DMESG_RESTRICT 118c2ecf20Sopenharmony_ci bool "Restrict unprivileged access to the kernel syslog" 128c2ecf20Sopenharmony_ci default n 138c2ecf20Sopenharmony_ci help 148c2ecf20Sopenharmony_ci This enforces restrictions on unprivileged users reading the kernel 158c2ecf20Sopenharmony_ci syslog via dmesg(8). 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci If this option is not selected, no restrictions will be enforced 188c2ecf20Sopenharmony_ci unless the dmesg_restrict sysctl is explicitly set to (1). 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci If you are unsure how to answer this question, answer N. 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciconfig SECURITY 238c2ecf20Sopenharmony_ci bool "Enable different security models" 248c2ecf20Sopenharmony_ci depends on SYSFS 258c2ecf20Sopenharmony_ci depends on MULTIUSER 268c2ecf20Sopenharmony_ci help 278c2ecf20Sopenharmony_ci This allows you to choose different security modules to be 288c2ecf20Sopenharmony_ci configured into your kernel. 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci If this option is not selected, the default Linux security 318c2ecf20Sopenharmony_ci model will be used. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci If you are unsure how to answer this question, answer N. 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciconfig SECURITY_WRITABLE_HOOKS 368c2ecf20Sopenharmony_ci depends on SECURITY 378c2ecf20Sopenharmony_ci bool 388c2ecf20Sopenharmony_ci default n 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciconfig SECURITYFS 418c2ecf20Sopenharmony_ci bool "Enable the securityfs filesystem" 428c2ecf20Sopenharmony_ci help 438c2ecf20Sopenharmony_ci This will build the securityfs filesystem. It is currently used by 448c2ecf20Sopenharmony_ci various security modules (AppArmor, IMA, SafeSetID, TOMOYO, TPM). 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci If you are unsure how to answer this question, answer N. 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ciconfig SECURITY_NETWORK 498c2ecf20Sopenharmony_ci bool "Socket and Networking Security Hooks" 508c2ecf20Sopenharmony_ci depends on SECURITY 518c2ecf20Sopenharmony_ci help 528c2ecf20Sopenharmony_ci This enables the socket and networking security hooks. 538c2ecf20Sopenharmony_ci If enabled, a security module can use these hooks to 548c2ecf20Sopenharmony_ci implement socket and networking access controls. 558c2ecf20Sopenharmony_ci If you are unsure how to answer this question, answer N. 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ciconfig SECURITY_INFINIBAND 588c2ecf20Sopenharmony_ci bool "Infiniband Security Hooks" 598c2ecf20Sopenharmony_ci depends on SECURITY && INFINIBAND 608c2ecf20Sopenharmony_ci help 618c2ecf20Sopenharmony_ci This enables the Infiniband security hooks. 628c2ecf20Sopenharmony_ci If enabled, a security module can use these hooks to 638c2ecf20Sopenharmony_ci implement Infiniband access controls. 648c2ecf20Sopenharmony_ci If you are unsure how to answer this question, answer N. 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ciconfig SECURITY_NETWORK_XFRM 678c2ecf20Sopenharmony_ci bool "XFRM (IPSec) Networking Security Hooks" 688c2ecf20Sopenharmony_ci depends on XFRM && SECURITY_NETWORK 698c2ecf20Sopenharmony_ci help 708c2ecf20Sopenharmony_ci This enables the XFRM (IPSec) networking security hooks. 718c2ecf20Sopenharmony_ci If enabled, a security module can use these hooks to 728c2ecf20Sopenharmony_ci implement per-packet access controls based on labels 738c2ecf20Sopenharmony_ci derived from IPSec policy. Non-IPSec communications are 748c2ecf20Sopenharmony_ci designated as unlabelled, and only sockets authorized 758c2ecf20Sopenharmony_ci to communicate unlabelled data can send without using 768c2ecf20Sopenharmony_ci IPSec. 778c2ecf20Sopenharmony_ci If you are unsure how to answer this question, answer N. 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ciconfig SECURITY_PATH 808c2ecf20Sopenharmony_ci bool "Security hooks for pathname based access control" 818c2ecf20Sopenharmony_ci depends on SECURITY 828c2ecf20Sopenharmony_ci help 838c2ecf20Sopenharmony_ci This enables the security hooks for pathname based access control. 848c2ecf20Sopenharmony_ci If enabled, a security module can use these hooks to 858c2ecf20Sopenharmony_ci implement pathname based access controls. 868c2ecf20Sopenharmony_ci If you are unsure how to answer this question, answer N. 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ciconfig INTEL_TXT 898c2ecf20Sopenharmony_ci bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)" 908c2ecf20Sopenharmony_ci depends on HAVE_INTEL_TXT 918c2ecf20Sopenharmony_ci help 928c2ecf20Sopenharmony_ci This option enables support for booting the kernel with the 938c2ecf20Sopenharmony_ci Trusted Boot (tboot) module. This will utilize 948c2ecf20Sopenharmony_ci Intel(R) Trusted Execution Technology to perform a measured launch 958c2ecf20Sopenharmony_ci of the kernel. If the system does not support Intel(R) TXT, this 968c2ecf20Sopenharmony_ci will have no effect. 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci Intel TXT will provide higher assurance of system configuration and 998c2ecf20Sopenharmony_ci initial state as well as data reset protection. This is used to 1008c2ecf20Sopenharmony_ci create a robust initial kernel measurement and verification, which 1018c2ecf20Sopenharmony_ci helps to ensure that kernel security mechanisms are functioning 1028c2ecf20Sopenharmony_ci correctly. This level of protection requires a root of trust outside 1038c2ecf20Sopenharmony_ci of the kernel itself. 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci Intel TXT also helps solve real end user concerns about having 1068c2ecf20Sopenharmony_ci confidence that their hardware is running the VMM or kernel that 1078c2ecf20Sopenharmony_ci it was configured with, especially since they may be responsible for 1088c2ecf20Sopenharmony_ci providing such assurances to VMs and services running on it. 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci See <https://www.intel.com/technology/security/> for more information 1118c2ecf20Sopenharmony_ci about Intel(R) TXT. 1128c2ecf20Sopenharmony_ci See <http://tboot.sourceforge.net> for more information about tboot. 1138c2ecf20Sopenharmony_ci See Documentation/x86/intel_txt.rst for a description of how to enable 1148c2ecf20Sopenharmony_ci Intel TXT support in a kernel boot. 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci If you are unsure as to whether this is required, answer N. 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ciconfig LSM_MMAP_MIN_ADDR 1198c2ecf20Sopenharmony_ci int "Low address space for LSM to protect from user allocation" 1208c2ecf20Sopenharmony_ci depends on SECURITY && SECURITY_SELINUX 1218c2ecf20Sopenharmony_ci default 32768 if ARM || (ARM64 && COMPAT) 1228c2ecf20Sopenharmony_ci default 65536 1238c2ecf20Sopenharmony_ci help 1248c2ecf20Sopenharmony_ci This is the portion of low virtual memory which should be protected 1258c2ecf20Sopenharmony_ci from userspace allocation. Keeping a user from writing to low pages 1268c2ecf20Sopenharmony_ci can help reduce the impact of kernel NULL pointer bugs. 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci For most ia64, ppc64 and x86 users with lots of address space 1298c2ecf20Sopenharmony_ci a value of 65536 is reasonable and should cause no problems. 1308c2ecf20Sopenharmony_ci On arm and other archs it should not be higher than 32768. 1318c2ecf20Sopenharmony_ci Programs which use vm86 functionality or have some need to map 1328c2ecf20Sopenharmony_ci this low address space will need the permission specific to the 1338c2ecf20Sopenharmony_ci systems running LSM. 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ciconfig HAVE_HARDENED_USERCOPY_ALLOCATOR 1368c2ecf20Sopenharmony_ci bool 1378c2ecf20Sopenharmony_ci help 1388c2ecf20Sopenharmony_ci The heap allocator implements __check_heap_object() for 1398c2ecf20Sopenharmony_ci validating memory ranges against heap object sizes in 1408c2ecf20Sopenharmony_ci support of CONFIG_HARDENED_USERCOPY. 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ciconfig HARDENED_USERCOPY 1438c2ecf20Sopenharmony_ci bool "Harden memory copies between kernel and userspace" 1448c2ecf20Sopenharmony_ci depends on HAVE_HARDENED_USERCOPY_ALLOCATOR 1458c2ecf20Sopenharmony_ci imply STRICT_DEVMEM 1468c2ecf20Sopenharmony_ci help 1478c2ecf20Sopenharmony_ci This option checks for obviously wrong memory regions when 1488c2ecf20Sopenharmony_ci copying memory to/from the kernel (via copy_to_user() and 1498c2ecf20Sopenharmony_ci copy_from_user() functions) by rejecting memory ranges that 1508c2ecf20Sopenharmony_ci are larger than the specified heap object, span multiple 1518c2ecf20Sopenharmony_ci separately allocated pages, are not on the process stack, 1528c2ecf20Sopenharmony_ci or are part of the kernel text. This kills entire classes 1538c2ecf20Sopenharmony_ci of heap overflow exploits and similar kernel memory exposures. 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ciconfig HARDENED_USERCOPY_FALLBACK 1568c2ecf20Sopenharmony_ci bool "Allow usercopy whitelist violations to fallback to object size" 1578c2ecf20Sopenharmony_ci depends on HARDENED_USERCOPY 1588c2ecf20Sopenharmony_ci default y 1598c2ecf20Sopenharmony_ci help 1608c2ecf20Sopenharmony_ci This is a temporary option that allows missing usercopy whitelists 1618c2ecf20Sopenharmony_ci to be discovered via a WARN() to the kernel log, instead of 1628c2ecf20Sopenharmony_ci rejecting the copy, falling back to non-whitelisted hardened 1638c2ecf20Sopenharmony_ci usercopy that checks the slab allocation size instead of the 1648c2ecf20Sopenharmony_ci whitelist size. This option will be removed once it seems like 1658c2ecf20Sopenharmony_ci all missing usercopy whitelists have been identified and fixed. 1668c2ecf20Sopenharmony_ci Booting with "slab_common.usercopy_fallback=Y/N" can change 1678c2ecf20Sopenharmony_ci this setting. 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ciconfig HARDENED_USERCOPY_PAGESPAN 1708c2ecf20Sopenharmony_ci bool "Refuse to copy allocations that span multiple pages" 1718c2ecf20Sopenharmony_ci depends on HARDENED_USERCOPY 1728c2ecf20Sopenharmony_ci depends on EXPERT 1738c2ecf20Sopenharmony_ci help 1748c2ecf20Sopenharmony_ci When a multi-page allocation is done without __GFP_COMP, 1758c2ecf20Sopenharmony_ci hardened usercopy will reject attempts to copy it. There are, 1768c2ecf20Sopenharmony_ci however, several cases of this in the kernel that have not all 1778c2ecf20Sopenharmony_ci been removed. This config is intended to be used only while 1788c2ecf20Sopenharmony_ci trying to find such users. 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ciconfig FORTIFY_SOURCE 1818c2ecf20Sopenharmony_ci bool "Harden common str/mem functions against buffer overflows" 1828c2ecf20Sopenharmony_ci depends on ARCH_HAS_FORTIFY_SOURCE 1838c2ecf20Sopenharmony_ci # https://bugs.llvm.org/show_bug.cgi?id=50322 1848c2ecf20Sopenharmony_ci # https://bugs.llvm.org/show_bug.cgi?id=41459 1858c2ecf20Sopenharmony_ci depends on !CC_IS_CLANG 1868c2ecf20Sopenharmony_ci help 1878c2ecf20Sopenharmony_ci Detect overflows of buffers in common string and memory functions 1888c2ecf20Sopenharmony_ci where the compiler can determine and validate the buffer sizes. 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ciconfig STATIC_USERMODEHELPER 1918c2ecf20Sopenharmony_ci bool "Force all usermode helper calls through a single binary" 1928c2ecf20Sopenharmony_ci help 1938c2ecf20Sopenharmony_ci By default, the kernel can call many different userspace 1948c2ecf20Sopenharmony_ci binary programs through the "usermode helper" kernel 1958c2ecf20Sopenharmony_ci interface. Some of these binaries are statically defined 1968c2ecf20Sopenharmony_ci either in the kernel code itself, or as a kernel configuration 1978c2ecf20Sopenharmony_ci option. However, some of these are dynamically created at 1988c2ecf20Sopenharmony_ci runtime, or can be modified after the kernel has started up. 1998c2ecf20Sopenharmony_ci To provide an additional layer of security, route all of these 2008c2ecf20Sopenharmony_ci calls through a single executable that can not have its name 2018c2ecf20Sopenharmony_ci changed. 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci Note, it is up to this single binary to then call the relevant 2048c2ecf20Sopenharmony_ci "real" usermode helper binary, based on the first argument 2058c2ecf20Sopenharmony_ci passed to it. If desired, this program can filter and pick 2068c2ecf20Sopenharmony_ci and choose what real programs are called. 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci If you wish for all usermode helper programs are to be 2098c2ecf20Sopenharmony_ci disabled, choose this option and then set 2108c2ecf20Sopenharmony_ci STATIC_USERMODEHELPER_PATH to an empty string. 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ciconfig STATIC_USERMODEHELPER_PATH 2138c2ecf20Sopenharmony_ci string "Path to the static usermode helper binary" 2148c2ecf20Sopenharmony_ci depends on STATIC_USERMODEHELPER 2158c2ecf20Sopenharmony_ci default "/sbin/usermode-helper" 2168c2ecf20Sopenharmony_ci help 2178c2ecf20Sopenharmony_ci The binary called by the kernel when any usermode helper 2188c2ecf20Sopenharmony_ci program is wish to be run. The "real" application's name will 2198c2ecf20Sopenharmony_ci be in the first argument passed to this program on the command 2208c2ecf20Sopenharmony_ci line. 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci If you wish for all usermode helper programs to be disabled, 2238c2ecf20Sopenharmony_ci specify an empty string here (i.e. ""). 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_cisource "security/selinux/Kconfig" 2268c2ecf20Sopenharmony_cisource "security/smack/Kconfig" 2278c2ecf20Sopenharmony_cisource "security/tomoyo/Kconfig" 2288c2ecf20Sopenharmony_cisource "security/apparmor/Kconfig" 2298c2ecf20Sopenharmony_cisource "security/loadpin/Kconfig" 2308c2ecf20Sopenharmony_cisource "security/yama/Kconfig" 2318c2ecf20Sopenharmony_cisource "security/safesetid/Kconfig" 2328c2ecf20Sopenharmony_cisource "security/lockdown/Kconfig" 2338c2ecf20Sopenharmony_cisource "security/xpm/Kconfig" 2348c2ecf20Sopenharmony_cisource "security/container_escape_detection/Kconfig" 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_cisource "security/integrity/Kconfig" 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_cichoice 2398c2ecf20Sopenharmony_ci prompt "First legacy 'major LSM' to be initialized" 2408c2ecf20Sopenharmony_ci default DEFAULT_SECURITY_SELINUX if SECURITY_SELINUX 2418c2ecf20Sopenharmony_ci default DEFAULT_SECURITY_SMACK if SECURITY_SMACK 2428c2ecf20Sopenharmony_ci default DEFAULT_SECURITY_TOMOYO if SECURITY_TOMOYO 2438c2ecf20Sopenharmony_ci default DEFAULT_SECURITY_APPARMOR if SECURITY_APPARMOR 2448c2ecf20Sopenharmony_ci default DEFAULT_SECURITY_DAC 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci help 2478c2ecf20Sopenharmony_ci This choice is there only for converting CONFIG_DEFAULT_SECURITY 2488c2ecf20Sopenharmony_ci in old kernel configs to CONFIG_LSM in new kernel configs. Don't 2498c2ecf20Sopenharmony_ci change this choice unless you are creating a fresh kernel config, 2508c2ecf20Sopenharmony_ci for this choice will be ignored after CONFIG_LSM has been set. 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci Selects the legacy "major security module" that will be 2538c2ecf20Sopenharmony_ci initialized first. Overridden by non-default CONFIG_LSM. 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci config DEFAULT_SECURITY_SELINUX 2568c2ecf20Sopenharmony_ci bool "SELinux" if SECURITY_SELINUX=y 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci config DEFAULT_SECURITY_SMACK 2598c2ecf20Sopenharmony_ci bool "Simplified Mandatory Access Control" if SECURITY_SMACK=y 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci config DEFAULT_SECURITY_TOMOYO 2628c2ecf20Sopenharmony_ci bool "TOMOYO" if SECURITY_TOMOYO=y 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci config DEFAULT_SECURITY_APPARMOR 2658c2ecf20Sopenharmony_ci bool "AppArmor" if SECURITY_APPARMOR=y 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci config DEFAULT_SECURITY_DAC 2688c2ecf20Sopenharmony_ci bool "Unix Discretionary Access Controls" 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ciendchoice 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ciconfig LSM 2738c2ecf20Sopenharmony_ci string "Ordered list of enabled LSMs" 2748c2ecf20Sopenharmony_ci default "lockdown,yama,loadpin,safesetid,integrity,smack,selinux,tomoyo,apparmor,bpf" if DEFAULT_SECURITY_SMACK 2758c2ecf20Sopenharmony_ci default "lockdown,yama,loadpin,safesetid,integrity,apparmor,selinux,smack,tomoyo,bpf" if DEFAULT_SECURITY_APPARMOR 2768c2ecf20Sopenharmony_ci default "lockdown,yama,loadpin,safesetid,integrity,tomoyo,bpf" if DEFAULT_SECURITY_TOMOYO 2778c2ecf20Sopenharmony_ci default "lockdown,yama,loadpin,safesetid,integrity,bpf" if DEFAULT_SECURITY_DAC 2788c2ecf20Sopenharmony_ci default "lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor,bpf" 2798c2ecf20Sopenharmony_ci help 2808c2ecf20Sopenharmony_ci A comma-separated list of LSMs, in initialization order. 2818c2ecf20Sopenharmony_ci Any LSMs left off this list will be ignored. This can be 2828c2ecf20Sopenharmony_ci controlled at boot with the "lsm=" parameter. 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci If unsure, leave this as the default. 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_cisource "security/Kconfig.hardening" 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ciendmenu 2898c2ecf20Sopenharmony_ci 290