Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.15 commit in: /
Date: Thu, 12 May 2022 11:27:54
Message-Id: 1652288681.8e7a70f33cfa13ed6f4a9f392ad47bd509cee810.mpagano@gentoo
1 commit: 8e7a70f33cfa13ed6f4a9f392ad47bd509cee810
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 11 17:04:41 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed May 11 17:04:41 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=8e7a70f3
7
8 Update Gentoo Hardened patchset based on KSPP thanks to Peter Bo
9
10 Bug: https://bugs.gentoo.org/841488
11
12 Added:
13 CONFIG_HARDENED_USERCOPY=y
14 CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
15 CONFIG_KFENCE=y
16 CONFIG_IOMMU_DEFAULT_DMA_STRICT=y
17 CONFIG_SCHED_CORE=y
18 CONFIG_ZERO_CALL_USED_REGS=y
19
20 Dropped deprecated option:
21 !DEVKMEM
22
23 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
24
25 4567_distro-Gentoo-Kconfig.patch | 34 +++++++++++++++-------------------
26 1 file changed, 15 insertions(+), 19 deletions(-)
27
28 diff --git a/4567_distro-Gentoo-Kconfig.patch b/4567_distro-Gentoo-Kconfig.patch
29 index ab910775..77ae7dc1 100644
30 --- a/4567_distro-Gentoo-Kconfig.patch
31 +++ b/4567_distro-Gentoo-Kconfig.patch
32 @@ -1,14 +1,14 @@
33 ---- a/Kconfig 2021-06-04 19:03:33.646823432 -0400
34 -+++ b/Kconfig 2021-06-04 19:03:40.508892817 -0400
35 +--- a/Kconfig 2022-05-11 08:37:26.685387031 -0400
36 ++++ b/Kconfig 2022-05-11 08:38:35.672171690 -0400
37 @@ -30,3 +30,5 @@ source "lib/Kconfig"
38 source "lib/Kconfig.debug"
39
40 source "Documentation/Kconfig"
41 +
42 +source "distro/Kconfig"
43 ---- /dev/null 2022-01-30 08:12:05.041788304 -0500
44 -+++ b/distro/Kconfig 2022-01-30 15:28:10.030352980 -0500
45 -@@ -0,0 +1,285 @@
46 +--- /dev/null 2022-05-10 13:47:17.750578524 -0400
47 ++++ b/distro/Kconfig 2022-05-11 12:43:39.114196110 -0400
48 +@@ -0,0 +1,290 @@
49 +menu "Gentoo Linux"
50 +
51 +config GENTOO_LINUX
52 @@ -185,7 +185,7 @@
53 +config GENTOO_KERNEL_SELF_PROTECTION_COMMON
54 + bool "Enable Kernel Self Protection Project Recommendations"
55 +
56 -+ depends on GENTOO_LINUX && !ACPI_CUSTOM_METHOD && !COMPAT_BRK && !DEVKMEM && !PROC_KCORE && !COMPAT_VDSO && !KEXEC && !HIBERNATION && !LEGACY_PTYS && !X86_X32 && !MODIFY_LDT_SYSCALL && GCC_PLUGINS
57 ++ depends on GENTOO_LINUX && !ACPI_CUSTOM_METHOD && !COMPAT_BRK && !PROC_KCORE && !COMPAT_VDSO && !KEXEC && !HIBERNATION && !LEGACY_PTYS && !X86_X32 && !MODIFY_LDT_SYSCALL && GCC_PLUGINS && !IOMMU_DEFAULT_DMA_LAZY && !IOMMU_DEFAULT_PASSTHROUGH && IOMMU_DEFAULT_DMA_STRICT
58 +
59 + select BUG
60 + select STRICT_KERNEL_RWX
61 @@ -199,7 +199,11 @@
62 + select DEBUG_NOTIFIERS
63 + select DEBUG_LIST
64 + select DEBUG_SG
65 ++ select HARDENED_USERCOPY if HAVE_HARDENED_USERCOPY_ALLOCATOR=y
66 + select BUG_ON_DATA_CORRUPTION
67 ++ select KFENCE if HAVE_ARCH_KFENCE && (!SLAB || SLUB)
68 ++ select RANDOMIZE_KSTACK_OFFSET_DEFAULT if HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET && (INIT_STACK_NONE || !CC_IS_CLANG || CLANG_VERSION>=140000)
69 ++ select SCHED_CORE if SCHED_SMT
70 + select SCHED_STACK_END_CHECK
71 + select SECCOMP if HAVE_ARCH_SECCOMP
72 + select SECCOMP_FILTER if HAVE_ARCH_SECCOMP_FILTER
73 @@ -222,6 +226,7 @@
74 + select GCC_PLUGIN_STRUCTLEAK_BYREF_ALL
75 + select GCC_PLUGIN_RANDSTRUCT
76 + select GCC_PLUGIN_RANDSTRUCT_PERFORMANCE
77 ++ select ZERO_CALL_USED_REGS if CC_HAS_ZERO_CALL_USED_REGS
78 +
79 + help
80 + Search for GENTOO_KERNEL_SELF_PROTECTION_{X86_64, ARM64, X86_32, ARM} for dependency
81 @@ -294,19 +299,9 @@
82 + See the settings that become available for more details and fine-tuning.
83 +
84 +endmenu
85 -diff --git a/security/Kconfig b/security/Kconfig
86 -index 7561f6f99..01f0bf73f 100644
87 ---- a/security/Kconfig
88 -+++ b/security/Kconfig
89 -@@ -166,6 +166,7 @@ config HARDENED_USERCOPY
90 - config HARDENED_USERCOPY_FALLBACK
91 - bool "Allow usercopy whitelist violations to fallback to object size"
92 - depends on HARDENED_USERCOPY
93 -+ depends on !GENTOO_KERNEL_SELF_PROTECTION
94 - default y
95 - help
96 - This is a temporary option that allows missing usercopy whitelists
97 -@@ -181,6 +182,7 @@ config HARDENED_USERCOPY_PAGESPAN
98 +--- a/security/Kconfig 2021-12-05 18:20:55.655677710 -0500
99 ++++ b/security/Kconfig 2021-12-05 18:23:42.404251618 -0500
100 +@@ -167,6 +167,7 @@ config HARDENED_USERCOPY_PAGESPAN
101 bool "Refuse to copy allocations that span multiple pages"
102 depends on HARDENED_USERCOPY
103 depends on EXPERT
104 @@ -353,3 +348,4 @@ index 24c045b24..e13fc740c 100644
105 This is the portion of low virtual memory which should be protected
106 --
107 2.31.1
108 +```