diff options
-rw-r--r-- | .SRCINFO | 26 | ||||
-rw-r--r-- | 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch | 4 | ||||
-rw-r--r-- | 0002-kvm-ioapic-Restrict-lazy-EOI-update-to-edge-triggere.patch | 79 | ||||
-rw-r--r-- | 0003-gcc-plugins-drop-support-for-GCC-4.7.patch | 277 | ||||
-rw-r--r-- | 0004-gcc-common.h-Update-for-GCC-10.patch | 86 | ||||
-rw-r--r-- | 0005-Makefile-disallow-data-races-on-gcc-10-as-well.patch | 32 | ||||
-rw-r--r-- | 0006-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch | 131 | ||||
-rw-r--r-- | PKGBUILD | 18 |
8 files changed, 556 insertions, 97 deletions
@@ -1,5 +1,5 @@ pkgbase = linux-rc - pkgver = 5.6.12rc1 + pkgver = 5.6.13rc1 pkgrel = 1 url = https://www.kernel.org/ arch = x86_64 @@ -9,24 +9,30 @@ pkgbase = linux-rc makedepends = bc makedepends = libelf options = !strip - source = https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.12-rc1.xz - source = https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.12-rc1.sign - source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.6.11.tar.xz - source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.6.11.tar.sign + source = https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.13-rc1.xz + source = https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.13-rc1.sign + source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.6.12.tar.xz + source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.6.12.tar.sign source = config source = 0000-sphinx-workaround.patch source = 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch - source = 0002-kvm-ioapic-Restrict-lazy-EOI-update-to-edge-triggere.patch + source = 0003-gcc-plugins-drop-support-for-GCC-4.7.patch + source = 0004-gcc-common.h-Update-for-GCC-10.patch + source = 0005-Makefile-disallow-data-races-on-gcc-10-as-well.patch + source = 0006-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E - sha256sums = c602f7d8941b7903850dd83fc041132db0109d4432e98f582c4761cdbeb8c6cd + sha256sums = 63640904b98d5cfd7994795c3a7296b8a052a24a7cecaaf7a867b342d0ec9b0f sha256sums = SKIP - sha256sums = d6dd6cbe99429f088eddb248abce7832e8f8e45eb072cbf0d0f86b5b87221baa + sha256sums = daea336aace63a9116475b3f698e259073c00bea57a2a545300dba1c45562221 sha256sums = SKIP sha256sums = f392c9ecbb5177ea2573aaf22935322940ea2be0366f3fb9c9f861431f4aed21 sha256sums = 8cb21e0b3411327b627a9dd15b8eb773295a0d2782b1a41b2a8839d1b2f5778c - sha256sums = a91cd1560d0312f00d0c3d31009e1ca3de83aa133adc3ae9740e2996ef4c3c4b - sha256sums = 7e0f02ca30bf51a1862c4cfc4d09641ba76c5fabaf452883aa495c421008f124 + sha256sums = 46c253f0d12b73a0cff3c40b82b656b7c7c423dac9abb61a391042d873eb9c47 + sha256sums = dc1418b2c3f793da567a4bd5e3ad5f161bd415ae20fc67fd68d1edc2f3afce71 + sha256sums = 04e773b9d80a17221ffdf7f1bd6ac0b9ec7d2963d0578bbc2edab1a553aac0d0 + sha256sums = 2165ef75486f37b84155dbd8dfd63bdf9dd2bc51517428dbfe42b93ad9e46c50 + sha256sums = 4f75e2f83e7bd2e0e65c0ce5b4feff9b4d204fa9531c92212b92809c46e4f3c3 pkgname = linux-rc pkgdesc = The release candidate kernel and modules diff --git a/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch b/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch index cf219767d2de..dbd5ac181817 100644 --- a/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch +++ b/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch @@ -1,7 +1,7 @@ -From e2679f79fbee1061a331bb2afd4e7c050ec21f76 Mon Sep 17 00:00:00 2001 +From f1107f172c74a9a8550a9e566c525ef28dbc139f Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> Date: Mon, 16 Sep 2019 04:53:20 +0200 -Subject: [PATCH 1/3] ZEN: Add sysctl and CONFIG to disallow unprivileged +Subject: [PATCH 1/7] ZEN: Add sysctl and CONFIG to disallow unprivileged CLONE_NEWUSER Our default behavior continues to match the vanilla kernel. diff --git a/0002-kvm-ioapic-Restrict-lazy-EOI-update-to-edge-triggere.patch b/0002-kvm-ioapic-Restrict-lazy-EOI-update-to-edge-triggere.patch deleted file mode 100644 index a950a72f5260..000000000000 --- a/0002-kvm-ioapic-Restrict-lazy-EOI-update-to-edge-triggere.patch +++ /dev/null @@ -1,79 +0,0 @@ -From da707adaee9ff035c943178160be54a90de00cb3 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini <pbonzini@redhat.com> -Date: Mon, 4 May 2020 12:19:45 -0400 -Subject: [PATCH 2/3] kvm: ioapic: Restrict lazy EOI update to edge-triggered - interrupts - -Commit f458d039db7e ("kvm: ioapic: Lazy update IOAPIC EOI") introduces -the following infinite loop: - -BUG: stack guard page was hit at 000000008f595917 \ -(stack is 00000000bdefe5a4..00000000ae2b06f5) -kernel stack overflow (double-fault): 0000 [#1] SMP NOPTI -RIP: 0010:kvm_set_irq+0x51/0x160 [kvm] -Call Trace: - irqfd_resampler_ack+0x32/0x90 [kvm] - kvm_notify_acked_irq+0x62/0xd0 [kvm] - kvm_ioapic_update_eoi_one.isra.0+0x30/0x120 [kvm] - ioapic_set_irq+0x20e/0x240 [kvm] - kvm_ioapic_set_irq+0x5c/0x80 [kvm] - kvm_set_irq+0xbb/0x160 [kvm] - ? kvm_hv_set_sint+0x20/0x20 [kvm] - irqfd_resampler_ack+0x32/0x90 [kvm] - kvm_notify_acked_irq+0x62/0xd0 [kvm] - kvm_ioapic_update_eoi_one.isra.0+0x30/0x120 [kvm] - ioapic_set_irq+0x20e/0x240 [kvm] - kvm_ioapic_set_irq+0x5c/0x80 [kvm] - kvm_set_irq+0xbb/0x160 [kvm] - ? kvm_hv_set_sint+0x20/0x20 [kvm] -.... - -The re-entrancy happens because the irq state is the OR of -the interrupt state and the resamplefd state. That is, we don't -want to show the state as 0 until we've had a chance to set the -resamplefd. But if the interrupt has _not_ gone low then -ioapic_set_irq is invoked again, causing an infinite loop. - -This can only happen for a level-triggered interrupt, otherwise -irqfd_inject would immediately set the KVM_USERSPACE_IRQ_SOURCE_ID high -and then low. Fortunately, in the case of level-triggered interrupts the VMEXIT already happens because -TMR is set. Thus, fix the bug by restricting the lazy invocation -of the ack notifier to edge-triggered interrupts, the only ones that -need it. - -Tested-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> -Reported-by: borisvk@bstnet.org -Suggested-by: Paolo Bonzini <pbonzini@redhat.com> -Link: https://www.spinics.net/lists/kvm/msg213512.html -Fixes: f458d039db7e ("kvm: ioapic: Lazy update IOAPIC EOI") -Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207489 -Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> ---- - arch/x86/kvm/ioapic.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c -index 750ff0b29404..d057376bd3d3 100644 ---- a/arch/x86/kvm/ioapic.c -+++ b/arch/x86/kvm/ioapic.c -@@ -225,12 +225,12 @@ static int ioapic_set_irq(struct kvm_ioapic *ioapic, unsigned int irq, - } - - /* -- * AMD SVM AVIC accelerate EOI write and do not trap, -- * in-kernel IOAPIC will not be able to receive the EOI. -- * In this case, we do lazy update of the pending EOI when -- * trying to set IOAPIC irq. -+ * AMD SVM AVIC accelerate EOI write iff the interrupt is edge -+ * triggered, in which case the in-kernel IOAPIC will not be able -+ * to receive the EOI. In this case, we do a lazy update of the -+ * pending EOI when trying to set IOAPIC irq. - */ -- if (kvm_apicv_activated(ioapic->kvm)) -+ if (edge && kvm_apicv_activated(ioapic->kvm)) - ioapic_lazy_update_eoi(ioapic, irq); - - /* --- -2.26.2 - diff --git a/0003-gcc-plugins-drop-support-for-GCC-4.7.patch b/0003-gcc-plugins-drop-support-for-GCC-4.7.patch new file mode 100644 index 000000000000..bbc05d14d07f --- /dev/null +++ b/0003-gcc-plugins-drop-support-for-GCC-4.7.patch @@ -0,0 +1,277 @@ +From 79a6b30bb7e8e4ef1baffd8adca2ae594781b4ce Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada <masahiroy@kernel.org> +Date: Sun, 29 Mar 2020 20:08:32 +0900 +Subject: [PATCH 3/7] gcc-plugins: drop support for GCC <= 4.7 + +Nobody was opposed to raising minimum GCC version to 4.8 [1] +So, we will drop GCC <= 4.7 support sooner or later. + +We always use C++ compiler for building plugins for GCC >= 4.8. + +This commit drops the plugin support for GCC <= 4.7 a bit earlier, +which allows us to dump lots of code. + +[1] https://lkml.org/lkml/2020/1/23/545 + +Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> +Acked-by: Kees Cook <keescook@chromium.org> +--- + scripts/Kconfig.include | 3 -- + scripts/Makefile.build | 2 +- + scripts/Makefile.clean | 1 - + scripts/Makefile.host | 23 +-------------- + scripts/gcc-plugin.sh | 55 +++--------------------------------- + scripts/gcc-plugins/Kconfig | 12 ++------ + scripts/gcc-plugins/Makefile | 21 ++++---------- + 7 files changed, 14 insertions(+), 103 deletions(-) + +diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include +index 496d11c92c97..033f6efd92d3 100644 +--- a/scripts/Kconfig.include ++++ b/scripts/Kconfig.include +@@ -42,9 +42,6 @@ $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) + # Fail if the linker is gold as it's not capable of linking the kernel proper + $(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supported) + +-# gcc version including patch level +-gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) +- + # machine bit flags + # $(m32-flag): -m32 if the compiler supports it, or an empty string otherwise. + # $(m64-flag): -m64 if the compiler supports it, or an empty string otherwise. +diff --git a/scripts/Makefile.build b/scripts/Makefile.build +index a1730d42e5f3..eec789d7a63a 100644 +--- a/scripts/Makefile.build ++++ b/scripts/Makefile.build +@@ -46,7 +46,7 @@ include $(kbuild-file) + include scripts/Makefile.lib + + # Do not include host rules unless needed +-ifneq ($(hostprogs)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) ++ifneq ($(hostprogs)$(hostcxxlibs-y)$(hostcxxlibs-m),) + include scripts/Makefile.host + endif + +diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean +index 1e4206566a82..075f0cc2d8d7 100644 +--- a/scripts/Makefile.clean ++++ b/scripts/Makefile.clean +@@ -30,7 +30,6 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) + __clean-files := $(extra-y) $(extra-m) $(extra-) \ + $(always) $(always-y) $(always-m) $(always-) $(targets) $(clean-files) \ + $(hostprogs) $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ +- $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ + $(hostcxxlibs-y) $(hostcxxlibs-m) + + __clean-files := $(filter-out $(no-clean-files), $(__clean-files)) +diff --git a/scripts/Makefile.host b/scripts/Makefile.host +index 3b7121d43324..2045855d0b75 100644 +--- a/scripts/Makefile.host ++++ b/scripts/Makefile.host +@@ -39,7 +39,6 @@ $(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE + # They are linked as C++ code to the executable qconf + + __hostprogs := $(sort $(hostprogs)) +-host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m)) + host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m)) + + # C code +@@ -63,7 +62,6 @@ host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) + host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) + + # Object (.o) files used by the shared libaries +-host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) + host-cxxshobjs := $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs)))) + + host-csingle := $(addprefix $(obj)/,$(host-csingle)) +@@ -71,9 +69,7 @@ host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) + host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) + host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) + host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) +-host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) + host-cxxshlib := $(addprefix $(obj)/,$(host-cxxshlib)) +-host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) + host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs)) + + ##### +@@ -140,13 +136,6 @@ quiet_cmd_host-cxxobjs = HOSTCXX $@ + $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE + $(call if_changed_dep,host-cxxobjs) + +-# Compile .c file, create position independent .o file +-# host-cshobjs -> .o +-quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ +- cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< +-$(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE +- $(call if_changed_dep,host-cshobjs) +- + # Compile .c file, create position independent .o file + # Note that plugin capable gcc versions can be either C or C++ based + # therefore plugin source files have to be compilable in both C and C++ mode. +@@ -157,16 +146,6 @@ quiet_cmd_host-cxxshobjs = HOSTCXX -fPIC $@ + $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE + $(call if_changed_dep,host-cxxshobjs) + +-# Link a shared library, based on position independent .o files +-# *.o -> .so shared library (host-cshlib) +-quiet_cmd_host-cshlib = HOSTLLD -shared $@ +- cmd_host-cshlib = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ +- $(addprefix $(obj)/, $($(target-stem)-objs)) \ +- $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so) +-$(host-cshlib): FORCE +- $(call if_changed,host-cshlib) +-$(call multi_depend, $(host-cshlib), .so, -objs) +- + # Link a shared library, based on position independent .o files + # *.o -> .so shared library (host-cxxshlib) + quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ +@@ -178,4 +157,4 @@ $(host-cxxshlib): FORCE + $(call multi_depend, $(host-cxxshlib), .so, -objs) + + targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ +- $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) $(host-cxxshlib) $(host-cxxshobjs) ++ $(host-cxxmulti) $(host-cxxobjs) $(host-cxxshlib) $(host-cxxshobjs) +diff --git a/scripts/gcc-plugin.sh b/scripts/gcc-plugin.sh +index d3caefe53eab..b79fd0bea838 100755 +--- a/scripts/gcc-plugin.sh ++++ b/scripts/gcc-plugin.sh +@@ -1,49 +1,14 @@ + #!/bin/sh + # SPDX-License-Identifier: GPL-2.0 +-srctree=$(dirname "$0") +- +-SHOW_ERROR= +-if [ "$1" = "--show-error" ] ; then +- SHOW_ERROR=1 +- shift || true +-fi +- +-gccplugins_dir=$($3 -print-file-name=plugin) +-plugincc=$($1 -E -x c++ - -o /dev/null -I"${srctree}"/gcc-plugins -I"${gccplugins_dir}"/include 2>&1 <<EOF +-#include "gcc-common.h" +-#if BUILDING_GCC_VERSION >= 4008 || defined(ENABLE_BUILD_WITH_CXX) +-#warning $2 CXX +-#else +-#warning $1 CC +-#endif +-EOF +-) + +-if [ $? -ne 0 ] +-then +- if [ -n "$SHOW_ERROR" ] ; then +- echo "${plugincc}" >&2 +- fi +- exit 1 +-fi ++set -e + +-case "$plugincc" in +- *"$1 CC"*) +- echo "$1" +- exit 0 +- ;; +- +- *"$2 CXX"*) +- # the c++ compiler needs another test, see below +- ;; ++srctree=$(dirname "$0") + +- *) +- exit 1 +- ;; +-esac ++gccplugins_dir=$($* -print-file-name=plugin) + + # we need a c++ compiler that supports the designated initializer GNU extension +-plugincc=$($2 -c -x c++ -std=gnu++98 - -fsyntax-only -I"${srctree}"/gcc-plugins -I"${gccplugins_dir}"/include 2>&1 <<EOF ++$HOSTCC -c -x c++ -std=gnu++98 - -fsyntax-only -I $srctree/gcc-plugins -I $gccplugins_dir/include 2>/dev/null <<EOF + #include "gcc-common.h" + class test { + public: +@@ -52,15 +17,3 @@ public: + .test = 1 + }; + EOF +-) +- +-if [ $? -eq 0 ] +-then +- echo "$2" +- exit 0 +-fi +- +-if [ -n "$SHOW_ERROR" ] ; then +- echo "${plugincc}" >&2 +-fi +-exit 1 +diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig +index e3569543bdac..fd31ed5b435f 100644 +--- a/scripts/gcc-plugins/Kconfig ++++ b/scripts/gcc-plugins/Kconfig +@@ -1,13 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0-only +-preferred-plugin-hostcc := $(if-success,[ $(gcc-version) -ge 40800 ],$(HOSTCXX),$(HOSTCC)) +- +-config PLUGIN_HOSTCC +- string +- default "$(shell,$(srctree)/scripts/gcc-plugin.sh "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")" if CC_IS_GCC +- help +- Host compiler used to build GCC plugins. This can be $(HOSTCXX), +- $(HOSTCC), or a null string if GCC plugin is unsupported. +- + config HAVE_GCC_PLUGINS + bool + help +@@ -17,7 +8,8 @@ config HAVE_GCC_PLUGINS + menuconfig GCC_PLUGINS + bool "GCC plugins" + depends on HAVE_GCC_PLUGINS +- depends on PLUGIN_HOSTCC != "" ++ depends on CC_IS_GCC && GCC_VERSION >= 40800 ++ depends on $(success,$(srctree)/scripts/gcc-plugin.sh $(CC)) + default y + help + GCC plugins are loadable modules that provide extra features to the +diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile +index f2ee8bd7abc6..f22858b2c3d6 100644 +--- a/scripts/gcc-plugins/Makefile ++++ b/scripts/gcc-plugins/Makefile +@@ -1,18 +1,9 @@ + # SPDX-License-Identifier: GPL-2.0 +-PLUGINCC := $(CONFIG_PLUGIN_HOSTCC:"%"=%) + GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin) + +-ifeq ($(PLUGINCC),$(HOSTCC)) +- HOSTLIBS := hostlibs +- HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb +- export HOST_EXTRACFLAGS +-else +- HOSTLIBS := hostcxxlibs +- 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 +- export HOST_EXTRACXXFLAGS +-endif ++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 -Wno-c++11-compat + + $(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h + quiet_cmd_create_randomize_layout_seed = GENSEED $@ +@@ -22,9 +13,9 @@ $(objtree)/$(obj)/randomize_layout_seed.h: FORCE + $(call if_changed,create_randomize_layout_seed) + targets = randomize_layout_seed.h randomize_layout_hash.h + +-$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) +-always-y := $($(HOSTLIBS)-y) ++hostcxxlibs-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) ++always-y := $(hostcxxlibs-y) + +-$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) ++$(foreach p,$(hostcxxlibs-y:%.so=%),$(eval $(p)-objs := $(p).o)) + + clean-files += *.so +-- +2.26.2 + diff --git a/0004-gcc-common.h-Update-for-GCC-10.patch b/0004-gcc-common.h-Update-for-GCC-10.patch new file mode 100644 index 000000000000..2ce306726d97 --- /dev/null +++ b/0004-gcc-common.h-Update-for-GCC-10.patch @@ -0,0 +1,86 @@ +From e5d7c52e5b460940175b26075cf86df5fb6b06a2 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 4/7] 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 f22858b2c3d6..80f354289eeb 100644 +--- a/scripts/gcc-plugins/Makefile ++++ b/scripts/gcc-plugins/Makefile +@@ -4,6 +4,7 @@ GCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin) + 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 -Wno-c++11-compat ++HOST_EXTRACXXFLAGS += -Wno-format-diag + + $(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h + quiet_cmd_create_randomize_layout_seed = GENSEED $@ +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,6 +849,7 @@ 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) +@@ -860,6 +863,7 @@ 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/0005-Makefile-disallow-data-races-on-gcc-10-as-well.patch b/0005-Makefile-disallow-data-races-on-gcc-10-as-well.patch new file mode 100644 index 000000000000..ab9fb3dd255a --- /dev/null +++ b/0005-Makefile-disallow-data-races-on-gcc-10-as-well.patch @@ -0,0 +1,32 @@ +From 9d03a04a2d7097afd3c177e8125e7b65e2d26102 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <slyfox@gentoo.org> +Date: Tue, 17 Mar 2020 00:07:18 +0000 +Subject: [PATCH 5/7] 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 97e4c4d9ac95..5ee8b2d86bab 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 +-- +2.26.2 + diff --git a/0006-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch b/0006-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch new file mode 100644 index 000000000000..69101597ca48 --- /dev/null +++ b/0006-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch @@ -0,0 +1,131 @@ +From 0cf3349234df93705eb0b24070e91c8132de42b7 Mon Sep 17 00:00:00 2001 +From: Borislav Petkov <bp@suse.de> +Date: Wed, 22 Apr 2020 18:11:30 +0200 +Subject: [PATCH 6/7] 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 + @@ -7,7 +7,7 @@ _srcname=linux-5.6 _major=5.6 ### on initial release this is null otherwise it is the current stable subversion ### ie 1,2,3 corresponding $_major.1, $_major.3 etc. -_minor=11 +_minor=12 ### on initial release comment this out and set to =1 _minorc=$((_minor+1)) #_minorc=1 @@ -32,20 +32,26 @@ source=( config # the main kernel config file 0000-sphinx-workaround.patch 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch - 0002-kvm-ioapic-Restrict-lazy-EOI-update-to-edge-triggere.patch + 0003-gcc-plugins-drop-support-for-GCC-4.7.patch + 0004-gcc-common.h-Update-for-GCC-10.patch + 0005-Makefile-disallow-data-races-on-gcc-10-as-well.patch + 0006-x86-Fix-early-boot-crash-on-gcc-10-next-try.patch ) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman ) -sha256sums=('c602f7d8941b7903850dd83fc041132db0109d4432e98f582c4761cdbeb8c6cd' +sha256sums=('63640904b98d5cfd7994795c3a7296b8a052a24a7cecaaf7a867b342d0ec9b0f' 'SKIP' - 'd6dd6cbe99429f088eddb248abce7832e8f8e45eb072cbf0d0f86b5b87221baa' + 'daea336aace63a9116475b3f698e259073c00bea57a2a545300dba1c45562221' 'SKIP' 'f392c9ecbb5177ea2573aaf22935322940ea2be0366f3fb9c9f861431f4aed21' '8cb21e0b3411327b627a9dd15b8eb773295a0d2782b1a41b2a8839d1b2f5778c' - 'a91cd1560d0312f00d0c3d31009e1ca3de83aa133adc3ae9740e2996ef4c3c4b' - '7e0f02ca30bf51a1862c4cfc4d09641ba76c5fabaf452883aa495c421008f124') + '46c253f0d12b73a0cff3c40b82b656b7c7c423dac9abb61a391042d873eb9c47' + 'dc1418b2c3f793da567a4bd5e3ad5f161bd415ae20fc67fd68d1edc2f3afce71' + '04e773b9d80a17221ffdf7f1bd6ac0b9ec7d2963d0578bbc2edab1a553aac0d0' + '2165ef75486f37b84155dbd8dfd63bdf9dd2bc51517428dbfe42b93ad9e46c50' + '4f75e2f83e7bd2e0e65c0ce5b4feff9b4d204fa9531c92212b92809c46e4f3c3') _kernelname=${pkgbase#linux} |