summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--0004-Makefile-disallow-data-races-on-gcc-10-as-well.patch32
-rw-r--r--0005-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch131
-rw-r--r--PKGBUILD10
3 files changed, 2 insertions, 171 deletions
diff --git a/0004-Makefile-disallow-data-races-on-gcc-10-as-well.patch b/0004-Makefile-disallow-data-races-on-gcc-10-as-well.patch
deleted file mode 100644
index 26537e4..0000000
--- a/0004-Makefile-disallow-data-races-on-gcc-10-as-well.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From af805f5f1d2e61dd2cf907d9635f0abc66fe1197 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Tue, 17 Mar 2020 00:07:18 +0000
-Subject: Makefile: disallow data races on gcc-10 as well
-
-gcc-10 will rename --param=allow-store-data-races=0
-to -fno-allow-store-data-races.
-
-The flag change happened at https://gcc.gnu.org/PR92046.
-
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-Acked-by: Jiri Kosina <jkosina@suse.cz>
-Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
----
- Makefile | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/Makefile b/Makefile
-index 5dedd6f9ad75..6899bfc9dc7b 100644
---- a/Makefile
-+++ b/Makefile
-@@ -714,6 +714,7 @@ endif
-
- # Tell gcc to never replace conditional load with a non-conditional one
- KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
-+KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
-
- include scripts/Makefile.kcov
- include scripts/Makefile.gcc-plugins
---
-cgit v1.2.3-1-gf6bb5
-
diff --git a/0005-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch b/0005-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch
deleted file mode 100644
index 140111c..0000000
--- a/0005-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From 309b6eca2e2605accf7a3b02b47b5c2732dbe543 Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Wed, 22 Apr 2020 18:11:30 +0200
-Subject: x86: Fix early boot crash on gcc-10, next try
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-... or the odyssey of trying to disable the stack protector for the
-function which generates the stack canary value.
-
-The whole story started with Sergei reporting a boot crash with a kernel
-built with gcc-10:
-
- Kernel panic — not syncing: stack-protector: Kernel stack is corrupted in: start_secondary
- CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.6.0-rc5—00235—gfffb08b37df9 #139
- Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./H77M—D3H, BIOS F12 11/14/2013
- Call Trace:
- dump_stack
- panic
- ? start_secondary
- __stack_chk_fail
- start_secondary
- secondary_startup_64
- -—-[ end Kernel panic — not syncing: stack—protector: Kernel stack is corrupted in: start_secondary
-
-This happens because gcc-10 tail-call optimizes the last function call
-in start_secondary() - cpu_startup_entry() - and thus emits a stack
-canary check which fails because the canary value changes after the
-boot_init_stack_canary() call.
-
-To fix that, the initial attempt was to mark the one function which
-generates the stack canary with:
-
- __attribute__((optimize("-fno-stack-protector"))) ... start_secondary(void *unused)
-
-however, using the optimize attribute doesn't work cumulatively
-as the attribute does not add to but rather replaces previously
-supplied optimization options - roughly all -fxxx options.
-
-The key one among them being -fno-omit-frame-pointer and thus leading to
-not present frame pointer - frame pointer which the kernel needs.
-
-The next attempt to prevent compilers from tail-call optimizing
-the last function call cpu_startup_entry(), shy of carving out
-start_secondary() into a separate compilation unit and building it with
--fno-stack-protector, is this one.
-
-The current solution is short and sweet, and reportedly, is supported by
-both compilers so let's see how far we'll get this time.
-
-Reported-by: Sergei Trofimovich <slyfox@gentoo.org>
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
-Reviewed-by: Kees Cook <keescook@chromium.org>
-Link: https://lkml.kernel.org/r/20200314164451.346497-1-slyfox@gentoo.org
----
- arch/x86/include/asm/stackprotector.h | 7 ++++++-
- arch/x86/kernel/smpboot.c | 8 ++++++++
- arch/x86/xen/smp_pv.c | 1 +
- include/linux/compiler.h | 6 ++++++
- 4 files changed, 21 insertions(+), 1 deletion(-)
-
-diff --git a/arch/x86/include/asm/stackprotector.h b/arch/x86/include/asm/stackprotector.h
-index 91e29b6a86a5..9804a7957f4e 100644
---- a/arch/x86/include/asm/stackprotector.h
-+++ b/arch/x86/include/asm/stackprotector.h
-@@ -55,8 +55,13 @@
- /*
- * Initialize the stackprotector canary value.
- *
-- * NOTE: this must only be called from functions that never return,
-+ * NOTE: this must only be called from functions that never return
- * and it must always be inlined.
-+ *
-+ * In addition, it should be called from a compilation unit for which
-+ * stack protector is disabled. Alternatively, the caller should not end
-+ * with a function call which gets tail-call optimized as that would
-+ * lead to checking a modified canary value.
- */
- static __always_inline void boot_init_stack_canary(void)
- {
-diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
-index 69881b2d446c..9674321ce3a3 100644
---- a/arch/x86/kernel/smpboot.c
-+++ b/arch/x86/kernel/smpboot.c
-@@ -262,6 +262,14 @@ static void notrace start_secondary(void *unused)
-
- wmb();
- cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
-+
-+ /*
-+ * Prevent tail call to cpu_startup_entry() because the stack protector
-+ * guard has been changed a couple of function calls up, in
-+ * boot_init_stack_canary() and must not be checked before tail calling
-+ * another function.
-+ */
-+ prevent_tail_call_optimization();
- }
-
- /**
-diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c
-index 802ee5bba66c..0cebe5db691d 100644
---- a/arch/x86/xen/smp_pv.c
-+++ b/arch/x86/xen/smp_pv.c
-@@ -92,6 +92,7 @@ asmlinkage __visible void cpu_bringup_and_idle(void)
- cpu_bringup();
- boot_init_stack_canary();
- cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
-+ prevent_tail_call_optimization();
- }
-
- void xen_smp_intr_free_pv(unsigned int cpu)
-diff --git a/include/linux/compiler.h b/include/linux/compiler.h
-index 034b0a644efc..732754d96039 100644
---- a/include/linux/compiler.h
-+++ b/include/linux/compiler.h
-@@ -356,4 +356,10 @@ static inline void *offset_to_ptr(const int *off)
- /* &a[0] degrades to a pointer: a different type from an array */
- #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
-
-+/*
-+ * This is needed in functions which generate the stack canary, see
-+ * arch/x86/kernel/smpboot.c::start_secondary() for an example.
-+ */
-+#define prevent_tail_call_optimization() asm("")
-+
- #endif /* __LINUX_COMPILER_H */
---
-cgit v1.2.3-1-gf6bb5
-
diff --git a/PKGBUILD b/PKGBUILD
index f5ed900..cad82d3 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -21,7 +21,7 @@ _custom=1
pkgbase=linux-ck
_supver=5
_majver=6
-_minver=13
+_minver=14
_gccpatchver='20191217'
_gccpatchger='9.1'
_gccpatchker='5.5'
@@ -48,8 +48,6 @@ source=(
0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
0002-gcc-plugins-drop-support-for-GCC-47.patch
0003-gcc-common.h-Update-for-GCC-10.patch
- 0004-Makefile-disallow-data-races-on-gcc-10-as-well.patch
- 0005-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch
linux-ck-patch-${_supver}.${_majver}-${_ckpatchversion}.xz::http://ck.kolivas.org/patches/${_supver}.0/${_supver}.${_majver}/${_supver}.${_majver}-${_ckpatchversion}/patch-${_supver}.${_majver}-${_ckpatchversion}.xz
graysky_bdver2-hotfix.patch
kernel_gcc_patch-${_gccpatchver}.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/${_gccpatchver}.tar.gz
@@ -63,13 +61,11 @@ validpgpkeys=(
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
)
# https://www.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
-b2sums=('7d56cf56b4714e37b2ae199b731bcc749c137e46e4af1f7ba2963d637938ec2a5d3fe79de4a512fadea54b71eb7cb716f33f66732c76d1f700b81e97df5058fe'
+b2sums=('6613ae43fde5313c972a314a5e4008d32da51b87a5773e2f9819d53209e8661fd7436e029a3b28f21e26aab937fb0a4b1b6891bd1f865b642a386ae3d89470f7'
'SKIP'
'ab1fb19c67d4c107f75767581c33d9c1458b4d9fdb88f4adb41d30a36f5a2f95f1c48ef079eb87e1e6e8ce2f98b293195cb2c0f2a8ec975aa817453289158c6e'
'bb02c251158116f98241f7de95339fb3ffee4748171c89bb5ef666ec28676c4a36fe6ff5d93d315b451aac4cb56343c435cdd46d3249d09e2a8cba47bba594eb'
'e59aa4ed958bad23f84d1cfb567d97090ca1a4f442c52297786035db89823eac3fc603035304d9466db87b62664b3c444c2749019eb963e0cbc8752d78fc684f'
- '0c0115ef2ef1f7b82f6de806b940dca7ef09a99ab872d589996e88dee76ce9946352ab4ef895fc7dfd73cc58a3dac343a426d086bd33d27163fdbf7fdf406021'
- '0afcb581c316e94575cde01a320fd165a5bb1e9b0ddda1a9c7eeb132d66395c2544108607495bb35d79a6d56a7f58abb639c2a4b0d21fe1d0d5b6ed8c64adde9'
'20dba509c16cf41226414c2e70e2a3434573638bf93ce25786c2cd4663c98bfa04845cda780c750afbfa26918cffa394d905d16bd687d6145acb8dbd2489fdd0'
'1892bd22775eac3bcc4d37f4fd30c95346bf3a0888cbbff57fd614973b525390dff2e315ce35b2e498523cceaab94ff21a80475dee8df3de4dd8fc0fab07d74e'
'd76bd0bf237ea2bb7999fd3715cb664d89148cb0ade8057d57cdb40bc0a7954336e50ee077312e5e192398b0f35f055786deb98af9130d57e60f2ea040fbb66f'
@@ -97,8 +93,6 @@ prepare() {
patch -p1 -i ../0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
patch -p1 -i ../0002-gcc-plugins-drop-support-for-GCC-47.patch
patch -p1 -i ../0003-gcc-common.h-Update-for-GCC-10.patch
- patch -p1 -i ../0004-Makefile-disallow-data-races-on-gcc-10-as-well.patch
- patch -p1 -i ../0005-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch
patch -p1 -i ../sphinx-workaround.patch