summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge2020-05-14 12:38:49 +0200
committerDavid Runge2020-05-14 12:38:49 +0200
commit15456fc6c06c0d18cd13c9bb36e94841453d97eb (patch)
treefd1d4c51c3cabd704660b65fd462697521e3459b
parentb4505d0115795adf5f5e87f6832dab32e1834a49 (diff)
downloadaur-15456fc6c06c0d18cd13c9bb36e94841453d97eb.tar.gz
Upgrading to 5.4.39.23.
Adding upstream patches for gcc >= 10.1.0.
-rw-r--r--.SRCINFO22
-rw-r--r--0001-gcc-common.h-Update-for-GCC-10.patch92
-rw-r--r--0002-Makefile-disallow-data-races-on-gcc-10-as-well.patch32
-rw-r--r--0003-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch131
-rw-r--r--PKGBUILD18
-rw-r--r--config2
6 files changed, 282 insertions, 15 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 75fb29d83198..c9a20ba9b3bc 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = linux-rt-lts
pkgdesc = Linux RT LTS
- pkgver = 5.4.34.21
+ pkgver = 5.4.39.23
pkgrel = 1
url = https://wiki.linuxfoundation.org/realtime/start
arch = x86_64
@@ -15,26 +15,32 @@ pkgbase = linux-rt-lts
makedepends = python-sphinx_rtd_theme
makedepends = xmlto
options = !strip
- source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.34.tar.xz
- source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.34.tar.sign
- source = https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patch-5.4.34-rt21.patch.xz
- source = https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patch-5.4.34-rt21.patch.sign
+ source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.39.tar.xz
+ source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.39.tar.sign
+ source = https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patch-5.4.39-rt23.patch.xz
+ source = https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patch-5.4.39-rt23.patch.sign
source = config
source = 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
source = sphinx-workaround.patch
+ source = 0001-gcc-common.h-Update-for-GCC-10.patch
+ source = 0002-Makefile-disallow-data-races-on-gcc-10-as-well.patch
+ source = 0003-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
validpgpkeys = 8218F88849AAC522E94CF470A5E9288C4FA415FA
validpgpkeys = 64254695FFF0AA4466CC19E67B96E8162A8CF5D1
validpgpkeys = 5ED9A48FC54C0A22D1D0804CEBC26CDB5A56DE73
validpgpkeys = E644E2F1D45FA0B2EAA02F33109F098506FF0B14
- sha256sums = 903ec1334daba6a626688f799cc947b420cf6fc8ce83055313dc4e9978d64cd2
+ sha256sums = 5141965a61a7b1c538443782ec3ef25fe0c3f9cd4d70c4e9f969d16883f365c8
sha256sums = SKIP
- sha256sums = e4e73861fb95e326f3c6aafa9746906fa33d9ee5eeb8ad538745a4ea4dd1f0dd
+ sha256sums = 43536a906adf8a0bb203dca667c2bba7952fd7cea286af5417ac5b709def52d3
sha256sums = SKIP
- sha256sums = da703821d1e482471ea01c4a93fa7a05ae31d84aa4b7adf13ecb7005cc8d0a22
+ sha256sums = da8a4f209b0b67413ac5f7a6b51efef2ad0b74ab97dd70b097ce279ec72e0daf
sha256sums = a13581d3c6dc595206e4fe7fcf6b542e7a1bdbe96101f0f010fc5be49f99baf2
sha256sums = b7c814c8183e4645947a6dcc3cbf80431de8a8fd4e895b780f9a5fd92f82cb8e
+ sha256sums = 2b63997760aa823b5907c3c5653f35265e9c6320b812b4f4a8e7c74256dab7c7
+ sha256sums = 875400c2dded3c05588025e0095b529c53f317abcccc99507eff0a75f24aa93f
+ sha256sums = b7505c345722c4c1ca27c8d99114d4b8746e530acd9b7c4e5a0601b89bfba2d2
pkgname = linux-rt-lts
pkgdesc = The Linux RT LTS kernel and modules
diff --git a/0001-gcc-common.h-Update-for-GCC-10.patch b/0001-gcc-common.h-Update-for-GCC-10.patch
new file mode 100644
index 000000000000..1eef6746f78c
--- /dev/null
+++ b/0001-gcc-common.h-Update-for-GCC-10.patch
@@ -0,0 +1,92 @@
+From 1a84040203e73d1bccfdb99aed98042efe3ecd16 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?=
+ <frederic.pierret@qubes-os.org>
+Date: Tue, 7 Apr 2020 13:32:59 +0200
+Subject: [PATCH 1/3] gcc-common.h: Update for GCC 10
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Remove "params.h" include, which has been dropped in GCC 10.
+
+Remove is_a_helper() macro, which is now defined in gimple.h, as seen
+when running './scripts/gcc-plugin.sh g++ g++ gcc':
+
+In file included from <stdin>:1:
+./gcc-plugins/gcc-common.h:852:13: error: redefinition of ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’
+ 852 | inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~
+In file included from ./gcc-plugins/gcc-common.h:125,
+ from <stdin>:1:
+/usr/lib/gcc/x86_64-redhat-linux/10/plugin/include/gimple.h:1037:1: note: ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’ previously declared here
+ 1037 | is_a_helper <const ggoto *>::test (const gimple *gs)
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add -Wno-format-diag to scripts/gcc-plugins/Makefile to avoid
+meaningless warnings from error() formats used by plugins:
+
+scripts/gcc-plugins/structleak_plugin.c: In function ‘int plugin_init(plugin_name_args*, plugin_gcc_version*)’:
+scripts/gcc-plugins/structleak_plugin.c:253:12: warning: unquoted sequence of 2 consecutive punctuation characters ‘'-’ in format [-Wformat-diag]
+ 253 | error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
+Link: https://lore.kernel.org/r/20200407113259.270172-1-frederic.pierret@qubes-os.org
+[kees: include -Wno-format-diag for plugin builds]
+Signed-off-by: Kees Cook <keescook@chromium.org>
+---
+ scripts/gcc-plugins/Makefile | 1 +
+ scripts/gcc-plugins/gcc-common.h | 4 ++++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
+index aa0d0ec6936d..9e95862f2788 100644
+--- a/scripts/gcc-plugins/Makefile
++++ b/scripts/gcc-plugins/Makefile
+@@ -11,6 +11,7 @@ else
+ HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
+ HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
+ HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
++ HOST_EXTRACXXFLAGS += -Wno-format-diag
+ export HOST_EXTRACXXFLAGS
+ endif
+
+diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
+index 17f06079a712..9ad76b7f3f10 100644
+--- a/scripts/gcc-plugins/gcc-common.h
++++ b/scripts/gcc-plugins/gcc-common.h
+@@ -35,7 +35,9 @@
+ #include "ggc.h"
+ #include "timevar.h"
+
++#if BUILDING_GCC_VERSION < 10000
+ #include "params.h"
++#endif
+
+ #if BUILDING_GCC_VERSION <= 4009
+ #include "pointer-set.h"
+@@ -847,19 +849,21 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l
+ return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
+ }
+
++#if BUILDING_GCC_VERSION < 10000
+ template <>
+ template <>
+ inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
+ {
+ return gs->code == GIMPLE_GOTO;
+ }
+
+ template <>
+ template <>
+ inline bool is_a_helper<const greturn *>::test(const_gimple gs)
+ {
+ return gs->code == GIMPLE_RETURN;
+ }
++#endif
+
+ static inline gasm *as_a_gasm(gimple stmt)
+ {
+--
+2.26.2
+
diff --git a/0002-Makefile-disallow-data-races-on-gcc-10-as-well.patch b/0002-Makefile-disallow-data-races-on-gcc-10-as-well.patch
new file mode 100644
index 000000000000..b6676eed647e
--- /dev/null
+++ b/0002-Makefile-disallow-data-races-on-gcc-10-as-well.patch
@@ -0,0 +1,32 @@
+From 6a183a41a1945cb79660a78536182ce9c2568291 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Tue, 17 Mar 2020 00:07:18 +0000
+Subject: [PATCH 2/3] 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 ff2b90ddc9bc..c8dc1357079b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -713,6 +713,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
+--
+2.26.2
+
diff --git a/0003-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch b/0003-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch
new file mode 100644
index 000000000000..4d954fb92e12
--- /dev/null
+++ b/0003-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch
@@ -0,0 +1,131 @@
+From 2f18ace75890ccd9681f210efdb58662db0cb4c4 Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Wed, 22 Apr 2020 18:11:30 +0200
+Subject: [PATCH 3/3] 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 */
+--
+2.26.2
+
diff --git a/PKGBUILD b/PKGBUILD
index 8841c1e52cb4..1e0b10743d5d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,8 +1,8 @@
# Maintainer: Joakim Hernberg <jbh@alchemy.lu>
# Contributor: David Runge <dvzrv@archlinux.org>
-_pkgver=5.4.34
-_rtpatchver=21
+_pkgver=5.4.39
+_rtpatchver=23
pkgbase=linux-rt-lts
pkgver=${_pkgver}.${_rtpatchver}
pkgrel=1
@@ -22,6 +22,9 @@ source=(
'config'
'0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch'
'sphinx-workaround.patch'
+ '0001-gcc-common.h-Update-for-GCC-10.patch'
+ '0002-Makefile-disallow-data-races-on-gcc-10-as-well.patch'
+ '0003-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch'
)
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
@@ -31,13 +34,16 @@ validpgpkeys=(
'5ED9A48FC54C0A22D1D0804CEBC26CDB5A56DE73' # Steven Rostedt
'E644E2F1D45FA0B2EAA02F33109F098506FF0B14' # Thomas Gleixner
)
-sha256sums=('903ec1334daba6a626688f799cc947b420cf6fc8ce83055313dc4e9978d64cd2'
+sha256sums=('5141965a61a7b1c538443782ec3ef25fe0c3f9cd4d70c4e9f969d16883f365c8'
'SKIP'
- 'e4e73861fb95e326f3c6aafa9746906fa33d9ee5eeb8ad538745a4ea4dd1f0dd'
+ '43536a906adf8a0bb203dca667c2bba7952fd7cea286af5417ac5b709def52d3'
'SKIP'
- 'da703821d1e482471ea01c4a93fa7a05ae31d84aa4b7adf13ecb7005cc8d0a22'
+ 'da8a4f209b0b67413ac5f7a6b51efef2ad0b74ab97dd70b097ce279ec72e0daf'
'a13581d3c6dc595206e4fe7fcf6b542e7a1bdbe96101f0f010fc5be49f99baf2'
- 'b7c814c8183e4645947a6dcc3cbf80431de8a8fd4e895b780f9a5fd92f82cb8e')
+ 'b7c814c8183e4645947a6dcc3cbf80431de8a8fd4e895b780f9a5fd92f82cb8e'
+ '2b63997760aa823b5907c3c5653f35265e9c6320b812b4f4a8e7c74256dab7c7'
+ '875400c2dded3c05588025e0095b529c53f317abcccc99507eff0a75f24aa93f'
+ 'b7505c345722c4c1ca27c8d99114d4b8746e530acd9b7c4e5a0601b89bfba2d2')
export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase
diff --git a/config b/config
index f937190680fb..be630fb3378e 100644
--- a/config
+++ b/config
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
-# Linux/x86 5.4.34 Kernel Configuration
+# Linux/x86 5.4.39 Kernel Configuration
#
#