From 882210bca78ba8e29b7861f9aeed7ca45574f59b Mon Sep 17 00:00:00 2001 From: Denis Kirjanov Date: May 02 2023 17:15:35 +0000 Subject: Merge branch 'SLE12-SP5' of kerncvs.suse.de:/home/git/kernel-source into SLE12-SP5 --- diff --git a/blacklist.conf b/blacklist.conf index 7c0d893..743e873 100644 --- a/blacklist.conf +++ b/blacklist.conf @@ -2795,3 +2795,4 @@ fe5b6aaef72a0f7daa06e7960e0bee45c2984e41 # relevant only on SPARC a157802359f7451ed8046b2b6dbaca187797e062 # build cleanup 03f5eb300ad1241f854269a3e521b119189a4493 # build cleanup 7e7e1541c91615e9950d0b96bcd1806d297e970e # build cleanup +b648ab487f31bc4c38941bc770ea97fe394304bb # we don't have the original commit, nor do we care for 32bit diff --git a/patches.suse/crypto-x86-ghash-fix-unaligned-access-in-ghash_setkey.patch b/patches.suse/crypto-x86-ghash-fix-unaligned-access-in-ghash_setkey.patch new file mode 100644 index 0000000..9ed4057 --- /dev/null +++ b/patches.suse/crypto-x86-ghash-fix-unaligned-access-in-ghash_setkey.patch @@ -0,0 +1,46 @@ +From: Eric Biggers +Date: Mon, 19 Dec 2022 21:40:40 -0800 +Subject: crypto: x86/ghash - fix unaligned access in ghash_setkey() +Git-commit: 116db2704c193fff6d73ea6c2219625f0c9bdfc8 +Patch-mainline: v6.3-rc1 +References: git-fixes + +The key can be unaligned, so use the unaligned memory access helpers. + +Fixes: 8ceee72808d1 ("crypto: ghash-clmulni-intel - use C implementation for setkey()") +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Acked-by: Nikolay Borisov +--- + arch/x86/crypto/ghash-clmulni-intel_glue.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/x86/crypto/ghash-clmulni-intel_glue.c ++++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #define GHASH_BLOCK_SIZE 16 + #define GHASH_DIGEST_SIZE 16 +@@ -56,7 +57,6 @@ static int ghash_setkey(struct crypto_sh + const u8 *key, unsigned int keylen) + { + struct ghash_ctx *ctx = crypto_shash_ctx(tfm); +- be128 *x = (be128 *)key; + u64 a, b; + + if (keylen != GHASH_BLOCK_SIZE) { +@@ -65,8 +65,8 @@ static int ghash_setkey(struct crypto_sh + } + + /* perform multiplication by 'x' in GF(2^128) */ +- a = be64_to_cpu(x->a); +- b = be64_to_cpu(x->b); ++ a = get_unaligned_be64(key); ++ b = get_unaligned_be64(key+8); + + ctx->shash.a = (b << 1) | (a >> 63); + ctx->shash.b = (a << 1) | (b >> 63); diff --git a/patches.suse/x86-boot-avoid-using-intel-mnemonics-in-at-t-syntax-asm.patch b/patches.suse/x86-boot-avoid-using-intel-mnemonics-in-at-t-syntax-asm.patch new file mode 100644 index 0000000..cb8bc5a --- /dev/null +++ b/patches.suse/x86-boot-avoid-using-intel-mnemonics-in-at-t-syntax-asm.patch @@ -0,0 +1,72 @@ +From: Peter Zijlstra +Date: Tue, 10 Jan 2023 12:15:40 +0100 +Subject: x86/boot: Avoid using Intel mnemonics in AT&T syntax asm +Git-commit: 7c6dd961d0c8e7e8f9fdc65071fb09ece702e18d +Patch-mainline: v6.2-rc4 +References: git-fixes + +With 'GNU assembler (GNU Binutils for Debian) 2.39.90.20221231' the +build now reports: + + arch/x86/realmode/rm/../../boot/bioscall.S: Assembler messages: + arch/x86/realmode/rm/../../boot/bioscall.S:35: Warning: found `movsd'; assuming `movsl' was meant + arch/x86/realmode/rm/../../boot/bioscall.S:70: Warning: found `movsd'; assuming `movsl' was meant + + arch/x86/boot/bioscall.S: Assembler messages: + arch/x86/boot/bioscall.S:35: Warning: found `movsd'; assuming `movsl' was meant + arch/x86/boot/bioscall.S:70: Warning: found `movsd'; assuming `movsl' was meant + +Which is due to: + + PR gas/29525 + + Note that with the dropped CMPSD and MOVSD Intel Syntax string insn + templates taking operands, mixed IsString/non-IsString template groups + (with memory operands) cannot occur anymore. With that + maybe_adjust_templates() becomes unnecessary (and is hence being + removed). + +More details: https://sourceware.org/bugzilla/show_bug.cgi?id=29525 + +Borislav Petkov further explains: + + " the particular problem here is is that the 'd' suffix is + "conflicting" in the sense that you can have SSE mnemonics like movsD %xmm... + and the same thing also for string ops (which is the case here) so apparently + the agreement in binutils land is to use the always accepted suffixes 'l' or 'q' + and phase out 'd' slowly... " + +Fixes: 7a734e7dd93b ("x86, setup: "glove box" BIOS calls -- infrastructure") +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Acked-by: Borislav Petkov (AMD) +Link: https://lore.kernel.org/r/Y71I3Ex2pvIxMpsP@hirez.programming.kicks-ass.net + +Acked-by: Nikolay Borisov +--- + arch/x86/boot/bioscall.S | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/boot/bioscall.S b/arch/x86/boot/bioscall.S +index 5521ea12f44e..aa9b96457584 100644 +--- a/arch/x86/boot/bioscall.S ++++ b/arch/x86/boot/bioscall.S +@@ -32,7 +32,7 @@ + movw %dx, %si + movw %sp, %di + movw $11, %cx +- rep; movsd ++ rep; movsl + + /* Pop full state from the stack */ + popal +@@ -67,7 +67,7 @@ + jz 4f + movw %sp, %si + movw $11, %cx +- rep; movsd ++ rep; movsl + 4: addw $44, %sp + + /* Restore state and return */ + diff --git a/patches.suse/x86-fpu-prevent-fpu-state-corruption.patch b/patches.suse/x86-fpu-prevent-fpu-state-corruption.patch new file mode 100644 index 0000000..a73f119 --- /dev/null +++ b/patches.suse/x86-fpu-prevent-fpu-state-corruption.patch @@ -0,0 +1,139 @@ +From: Thomas Gleixner +Date: Sun, 1 May 2022 21:31:43 +0200 +Subject: x86/fpu: Prevent FPU state corruption +Git-commit: 59f5ede3bc0f00eb856425f636dab0c10feb06d8 +Patch-mainline: v5.18-rc6 +References: git-fixes + +The FPU usage related to task FPU management is either protected by +disabling interrupts (switch_to, return to user) or via fpregs_lock() which +is a wrapper around local_bh_disable(). When kernel code wants to use the +FPU then it has to check whether it is possible by calling irq_fpu_usable(). + +But the condition in irq_fpu_usable() is wrong. It allows FPU to be used +when: + + !in_interrupt() || interrupted_user_mode() || interrupted_kernel_fpu_idle() + +The latter is checking whether some other context already uses FPU in the +kernel, but if that's not the case then it allows FPU to be used +unconditionally even if the calling context interrupted a fpregs_lock() +critical region. If that happens then the FPU state of the interrupted +context becomes corrupted. + +Allow in kernel FPU usage only when no other context has in kernel FPU +usage and either the calling context is not hard interrupt context or the +hard interrupt did not interrupt a local bottomhalf disabled region. + +It's hard to find a proper Fixes tag as the condition was broken in one way +or the other for a very long time and the eager/lazy FPU changes caused a +lot of churn. Picked something remotely connected from the history. + +This survived undetected for quite some time as FPU usage in interrupt +context is rare, but the recent changes to the random code unearthed it at +least on a kernel which had FPU debugging enabled. There is probably a +higher rate of silent corruption as not all issues can be detected by the +FPU debugging code. This will be addressed in a subsequent change. + +Fixes: 5d2bd7009f30 ("x86, fpu: decouple non-lazy/eager fpu restore from xsave") +Reported-by: Filipe Manana +Signed-off-by: Thomas Gleixner +Tested-by: Filipe Manana +Reviewed-by: Borislav Petkov +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20220501193102.588689270@linutronix.de + +Acked-by: Nikolay Borisov +--- + arch/x86/kernel/fpu/core.c | 67 +++++++++++++++++---------------------------- + 1 file changed, 26 insertions(+), 41 deletions(-) + +--- a/arch/x86/kernel/fpu/core.c ++++ b/arch/x86/kernel/fpu/core.c +@@ -23,17 +23,7 @@ + */ + union fpregs_state init_fpstate __read_mostly; + +-/* +- * Track whether the kernel is using the FPU state +- * currently. +- * +- * This flag is used: +- * +- * - by IRQ context code to potentially use the FPU +- * if it's unused. +- * +- * - to debug kernel_fpu_begin()/end() correctness +- */ ++/* Track in-kernel FPU usage */ + static DEFINE_PER_CPU(bool, in_kernel_fpu); + + /* +@@ -53,42 +43,37 @@ static void kernel_fpu_enable(void) + this_cpu_write(in_kernel_fpu, false); + } + +-static bool kernel_fpu_disabled(void) +-{ +- return this_cpu_read(in_kernel_fpu); +-} +- +-static bool interrupted_kernel_fpu_idle(void) +-{ +- return !kernel_fpu_disabled(); +-} +- +-/* +- * Were we in user mode (or vm86 mode) when we were +- * interrupted? +- * +- * Doing kernel_fpu_begin/end() is ok if we are running +- * in an interrupt context from user mode - we'll just +- * save the FPU state as required. +- */ +-static bool interrupted_user_mode(void) +-{ +- struct pt_regs *regs = get_irq_regs(); +- return regs && user_mode(regs); +-} +- + /* + * Can we use the FPU in kernel mode with the + * whole "kernel_fpu_begin/end()" sequence? +- * +- * It's always ok in process context (ie "not interrupt") +- * but it is sometimes ok even from an irq. + */ + bool irq_fpu_usable(void) + { +- return !in_interrupt() || +- interrupted_user_mode() || +- interrupted_kernel_fpu_idle(); ++ if (WARN_ON_ONCE(in_nmi())) ++ return false; ++ ++ /* In kernel FPU usage already active? */ ++ if (this_cpu_read(in_kernel_fpu)) ++ return false; ++ ++ /* ++ * When not in NMI or hard interrupt context, FPU can be used in: ++ * ++ * - Task context except from within fpregs_lock()'ed critical ++ * regions. ++ * ++ * - Soft interrupt processing context which cannot happen ++ * while in a fpregs_lock()'ed critical region. ++ */ ++ if (!in_irq()) ++ return true; ++ ++ /* ++ * In hard interrupt context it's safe when soft interrupts ++ * are enabled, which means the interrupt did not hit in ++ * a fpregs_lock()'ed critical region. ++ */ ++ return !softirq_count(); + } + EXPORT_SYMBOL(irq_fpu_usable); + diff --git a/patches.suse/x86-irq-ensure-pi-wakeup-handler-is-unregistered-before-module-unload.patch b/patches.suse/x86-irq-ensure-pi-wakeup-handler-is-unregistered-before-module-unload.patch new file mode 100644 index 0000000..e507bfc --- /dev/null +++ b/patches.suse/x86-irq-ensure-pi-wakeup-handler-is-unregistered-before-module-unload.patch @@ -0,0 +1,44 @@ +From: Sean Christopherson +Date: Fri, 8 Oct 2021 17:11:04 -0700 +Subject: x86/irq: Ensure PI wakeup handler is unregistered before module unload +Git-commit: 6ff53f6a438f72998f56e82e76694a1df9d1ea2c +Patch-mainline: v5.16-rc1 +References: git-fixes + +Add a synchronize_rcu() after clearing the posted interrupt wakeup handler +to ensure all readers, i.e. in-flight IRQ handlers, see the new handler +before returning to the caller. If the caller is an exiting module and +is unregistering its handler, failure to wait could result in the IRQ +handler jumping into an unloaded module. + +The registration path doesn't require synchronization, as it's the +caller's responsibility to not generate interrupts it cares about until +after its handler is registered. + +Fixes: f6b3c72c2366 ("x86/irq: Define a global vector for VT-d Posted-Interrupts") +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Message-Id: <20211009001107.3936588-2-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Acked-by: Nikolay Borisov +--- + arch/x86/kernel/irq.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c +index e28f6a5d14f1..766ffe3ba313 100644 +--- a/arch/x86/kernel/irq.c ++++ b/arch/x86/kernel/irq.c +@@ -291,8 +291,10 @@ void kvm_set_posted_intr_wakeup_handler(void (*handler)(void)) + { + if (handler) + kvm_posted_intr_wakeup_handler = handler; +- else ++ else { + kvm_posted_intr_wakeup_handler = dummy_handler; ++ synchronize_rcu(); ++ } + } + EXPORT_SYMBOL_GPL(kvm_set_posted_intr_wakeup_handler); + + diff --git a/patches.suse/x86-kprobes-fix-to-check-non-boostable-prefixes-correctly.patch b/patches.suse/x86-kprobes-fix-to-check-non-boostable-prefixes-correctly.patch new file mode 100644 index 0000000..0aa36db --- /dev/null +++ b/patches.suse/x86-kprobes-fix-to-check-non-boostable-prefixes-correctly.patch @@ -0,0 +1,67 @@ +From: Masami Hiramatsu +Date: Thu, 25 Mar 2021 19:08:31 +0900 +Subject: x86/kprobes: Fix to check non boostable prefixes correctly +Git-commit: 6dd3b8c9f58816a1354be39559f630cd1bd12159 +Patch-mainline: v5.13-rc1 +References: git-fixes + +There are 2 bugs in the can_boost() function because of using +x86 insn decoder. Since the insn->opcode never has a prefix byte, +it can not find CS override prefix in it. And the insn->attr is +the attribute of the opcode, thus inat_is_address_size_prefix( +insn->attr) always returns false. + +Fix those by checking each prefix bytes with for_each_insn_prefix +loop and getting the correct attribute for each prefix byte. +Also, this removes unlikely, because this is a slow path. + +Fixes: a8d11cd0714f ("kprobes/x86: Consolidate insn decoder users for copying code") +Signed-off-by: Masami Hiramatsu +Signed-off-by: Ingo Molnar +Link: https://lore.kernel.org/r/161666691162.1120877.2808435205294352583.stgit@devnote2 + +Acked-by: Nikolay Borisov +--- + arch/x86/kernel/kprobes/core.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/arch/x86/kernel/kprobes/core.c ++++ b/arch/x86/kernel/kprobes/core.c +@@ -172,6 +172,8 @@ NOKPROBE_SYMBOL(skip_prefixes); + int can_boost(struct insn *insn, void *addr) + { + kprobe_opcode_t opcode; ++ insn_byte_t prefix; ++ int i; + + if (search_exception_tables((unsigned long)addr)) + return 0; /* Page fault may occur on this address. */ +@@ -184,9 +186,14 @@ int can_boost(struct insn *insn, void *a + if (insn->opcode.nbytes != 1) + return 0; + +- /* Can't boost Address-size override prefix */ +- if (unlikely(inat_is_address_size_prefix(insn->attr))) +- return 0; ++ for_each_insn_prefix(insn, i, prefix) { ++ insn_attr_t attr; ++ ++ attr = inat_get_opcode_attribute(prefix); ++ /* Can't boost Address-size override prefix and CS override prefix */ ++ if (prefix == 0x2e || inat_is_address_size_prefix(attr)) ++ return 0; ++ } + + opcode = insn->opcode.bytes[0]; + +@@ -211,8 +218,8 @@ int can_boost(struct insn *insn, void *a + /* clear and set flags are boostable */ + return (opcode == 0xf5 || (0xf7 < opcode && opcode < 0xfe)); + default: +- /* CS override prefix and call are not boostable */ +- return (opcode != 0x2e && opcode != 0x9a); ++ /* call is not boostable */ ++ return opcode != 0x9a; + } + } + diff --git a/patches.suse/x86-kprobes-restore-btf-if-the-single-stepping-is-cancelled.patch b/patches.suse/x86-kprobes-restore-btf-if-the-single-stepping-is-cancelled.patch new file mode 100644 index 0000000..43755bd --- /dev/null +++ b/patches.suse/x86-kprobes-restore-btf-if-the-single-stepping-is-cancelled.patch @@ -0,0 +1,43 @@ +From: Masami Hiramatsu +Date: Wed, 28 Oct 2020 23:31:10 +0900 +Subject: x86/kprobes: Restore BTF if the single-stepping is cancelled +Git-commit: 78ff2733ff352175eb7f4418a34654346e1b6cd2 +Patch-mainline: v5.11-rc1 +References: git-fixes + +Fix to restore BTF if single-stepping causes a page fault and +it is cancelled. + +Usually the BTF flag was restored when the single stepping is done +(in resume_execution()). However, if a page fault happens on the +single stepping instruction, the fault handler is invoked and +the single stepping is cancelled. Thus, the BTF flag is not +restored. + +Fixes: 1ecc798c6764 ("x86: debugctlmsr kprobes") +Signed-off-by: Masami Hiramatsu +Signed-off-by: Peter Zijlstra (Intel) +Link: https://lkml.kernel.org/r/160389546985.106936.12727996109376240993.stgit@devnote2 + +Acked-by: Nikolay Borisov +--- + arch/x86/kernel/kprobes/core.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c +index 547c7abb39f5..39f7d8c3c064 100644 +--- a/arch/x86/kernel/kprobes/core.c ++++ b/arch/x86/kernel/kprobes/core.c +@@ -937,6 +937,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr) + * So clear it by resetting the current kprobe: + */ + regs->flags &= ~X86_EFLAGS_TF; ++ /* ++ * Since the single step (trap) has been cancelled, ++ * we need to restore BTF here. ++ */ ++ restore_btf(); + + /* + * If the TF flag was set before the kprobe hit, + diff --git a/patches.suse/x86-mce-inject-avoid-out-of-bounds-write-when-setting-flags.patch b/patches.suse/x86-mce-inject-avoid-out-of-bounds-write-when-setting-flags.patch new file mode 100644 index 0000000..fce456a --- /dev/null +++ b/patches.suse/x86-mce-inject-avoid-out-of-bounds-write-when-setting-flags.patch @@ -0,0 +1,49 @@ +From: Zhang Zixun +Date: Mon, 27 Dec 2021 22:02:49 +0100 +Subject: x86/mce/inject: Avoid out-of-bounds write when setting flags +Git-commit: de768416b203ac84e02a757b782a32efb388476f +Patch-mainline: v5.17-rc1 +References: git-fixes + +A contrived zero-length write, for example, by using write(2): + + ... + ret = write(fd, str, 0); + ... + +to the "flags" file causes: + + BUG: KASAN: stack-out-of-bounds in flags_write + Write of size 1 at addr ffff888019be7ddf by task writefile/3787 + + CPU: 4 PID: 3787 Comm: writefile Not tainted 5.16.0-rc7+ #12 + Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 + +due to accessing buf one char before its start. + +Prevent such out-of-bounds access. + + [ bp: Productize into a proper patch. Link below is the next best + thing because the original mail didn't get archived on lore. ] + +Fixes: 0451d14d0561 ("EDAC, mce_amd_inj: Modify flags attribute to use string arguments") +Signed-off-by: Zhang Zixun +Signed-off-by: Borislav Petkov +Link: https://lore.kernel.org/linux-edac/YcnePfF1OOqoQwrX@zn.tnic/ + +Acked-by: Nikolay Borisov +--- + arch/x86/ras/mce_amd_inj.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/ras/mce_amd_inj.c ++++ b/arch/x86/ras/mce_amd_inj.c +@@ -151,7 +151,7 @@ static ssize_t flags_write(struct file * + char buf[MAX_FLAG_OPT_SIZE], *__buf; + int err; + +- if (cnt > MAX_FLAG_OPT_SIZE) ++ if (!cnt || cnt > MAX_FLAG_OPT_SIZE) + return -EINVAL; + + if (copy_from_user(&buf, ubuf, cnt)) diff --git a/patches.suse/x86-tools-fix-objdump-version-check-again.patch b/patches.suse/x86-tools-fix-objdump-version-check-again.patch new file mode 100644 index 0000000..de34c0b --- /dev/null +++ b/patches.suse/x86-tools-fix-objdump-version-check-again.patch @@ -0,0 +1,39 @@ +From: Randy Dunlap +Date: Fri, 30 Jul 2021 17:01:46 -0700 +Subject: x86/tools: Fix objdump version check again +Git-commit: 839ad22f755132838f406751439363c07272ad87 +Patch-mainline: v5.14-rc6 +References: git-fixes + +Skip (omit) any version string info that is parenthesized. + +Warning: objdump version 15) is older than 2.19 +Warning: Skipping posttest. + +where 'objdump -v' says: +GNU objdump (GNU Binutils; SUSE Linux Enterprise 15) 2.35.1.20201123-7.18 + +Fixes: 8bee738bb1979 ("x86: Fix objdump version check in chkobjdump.awk for different formats.") +Signed-off-by: Randy Dunlap +Signed-off-by: Thomas Gleixner +Reviewed-by: Masami Hiramatsu +Link: https://lore.kernel.org/r/20210731000146.2720-1-rdunlap@infradead.org + +Acked-by: Nikolay Borisov +--- + arch/x86/tools/chkobjdump.awk | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/x86/tools/chkobjdump.awk b/arch/x86/tools/chkobjdump.awk +index fd1ab80be0de..a4cf678cf5c8 100644 +--- a/arch/x86/tools/chkobjdump.awk ++++ b/arch/x86/tools/chkobjdump.awk +@@ -10,6 +10,7 @@ BEGIN { + + /^GNU objdump/ { + verstr = "" ++ gsub(/\(.*\)/, ""); + for (i = 3; i <= NF; i++) + if (match($(i), "^[0-9]")) { + verstr = $(i); + diff --git a/patches.suse/x86-tools-relocs-fix-non-posix-regexp.patch b/patches.suse/x86-tools-relocs-fix-non-posix-regexp.patch new file mode 100644 index 0000000..4855af7 --- /dev/null +++ b/patches.suse/x86-tools-relocs-fix-non-posix-regexp.patch @@ -0,0 +1,60 @@ +From: "H. Nikolaus Schaller" +Date: Thu, 8 Jul 2021 10:57:09 +0200 +Subject: x86/tools/relocs: Fix non-POSIX regexp +Git-commit: fa953adfad7cf9c7e30d9ea0e4ccfd38cfb5495d +Patch-mainline: v5.14-rc5 +References: git-fixes + +Trying to run a cross-compiled x86 relocs tool on a BSD based +HOSTCC leads to errors like + + VOFFSET arch/x86/boot/compressed/../voffset.h - due to: vmlinux + CC arch/x86/boot/compressed/misc.o - due to: arch/x86/boot/compressed/../voffset.h + OBJCOPY arch/x86/boot/compressed/vmlinux.bin - due to: vmlinux + RELOCS arch/x86/boot/compressed/vmlinux.relocs - due to: vmlinux +empty (sub)expressionarch/x86/boot/compressed/Makefile:118: recipe for target 'arch/x86/boot/compressed/vmlinux.relocs' failed +make[3]: *** [arch/x86/boot/compressed/vmlinux.relocs] Error 1 + +It turns out that relocs.c uses patterns like + + "something(|_end)" + +This is not valid syntax or gives undefined results according +to POSIX 9.5.3 ERE Grammar + + https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html + +It seems to be silently accepted by the Linux regexp() implementation +while a BSD host complains. + +Such patterns can be replaced by a transformation like + + "(|p1|p2)" -> "(p1|p2)?" + +Fixes: fd952815307f ("x86-32, relocs: Whitelist more symbols for ld bug workaround") +Signed-off-by: H. Nikolaus Schaller +Signed-off-by: Masahiro Yamada +Acked-by: Nikolay Borisov +--- + arch/x86/tools/relocs.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/x86/tools/relocs.c ++++ b/arch/x86/tools/relocs.c +@@ -54,12 +54,12 @@ static const char * const sym_regex_kern + [S_REL] = + "^(__init_(begin|end)|" + "__x86_cpu_dev_(start|end)|" +- "(__parainstructions|__alt_instructions)(|_end)|" +- "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|" ++ "(__parainstructions|__alt_instructions)(_end)?|" ++ "(__iommu_table|__apicdrivers|__smp_locks)(_end)?|" + "__(start|end)_pci_.*|" + "__(start|end)_builtin_fw|" +- "__(start|stop)___ksymtab(|_gpl|_unused|_unused_gpl|_gpl_future)|" +- "__(start|stop)___kcrctab(|_gpl|_unused|_unused_gpl|_gpl_future)|" ++ "__(start|stop)___ksymtab(_gpl|_unused|_unused_gpl|_gpl_future)?|" ++ "__(start|stop)___kcrctab(_gpl|_unused|_unused_gpl|_gpl_future)?|" + "__(start|stop)___param|" + "__(start|stop)___modver|" + "__(start|stop)___bug_table|" diff --git a/patches.suse/x86-virt-eat-faults-on-vmxoff-in-reboot-flows.patch b/patches.suse/x86-virt-eat-faults-on-vmxoff-in-reboot-flows.patch new file mode 100644 index 0000000..bdacfc3 --- /dev/null +++ b/patches.suse/x86-virt-eat-faults-on-vmxoff-in-reboot-flows.patch @@ -0,0 +1,62 @@ +From: Sean Christopherson +Date: Wed, 30 Dec 2020 16:26:54 -0800 +Subject: x86/virt: Eat faults on VMXOFF in reboot flows +Git-commit: aec511ad153556640fb1de38bfe00c69464f997f +Patch-mainline: v5.12-rc1 +References: git-fixes + +Silently ignore all faults on VMXOFF in the reboot flows as such faults +are all but guaranteed to be due to the CPU not being in VMX root. +Because (a) VMXOFF may be executed in NMI context, e.g. after VMXOFF but +before CR4.VMXE is cleared, (b) there's no way to query the CPU's VMX +state without faulting, and (c) the whole point is to get out of VMX +root, eating faults is the simplest way to achieve the desired behaior. + +Technically, VMXOFF can fault (or fail) for other reasons, but all other +fault and failure scenarios are mode related, i.e. the kernel would have +to magically end up in RM, V86, compat mode, at CPL>0, or running with +the SMI Transfer Monitor active. The kernel is beyond hosed if any of +those scenarios are encountered; trying to do something fancy in the +error path to handle them cleanly is pointless. + +Fixes: 1e9931146c74 ("x86: asm/virtext.h: add cpu_vmxoff() inline function") +Reported-by: David P. Reed +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Message-Id: <20201231002702.2223707-2-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Acked-by: Nikolay Borisov +--- + arch/x86/include/asm/virtext.h | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/arch/x86/include/asm/virtext.h ++++ b/arch/x86/include/asm/virtext.h +@@ -32,15 +32,22 @@ static inline int cpu_has_vmx(void) + } + + +-/** Disable VMX on the current CPU ++/** ++ * cpu_vmxoff() - Disable VMX on the current CPU + * +- * vmxoff causes a undefined-opcode exception if vmxon was not run +- * on the CPU previously. Only call this function if you know VMX +- * is enabled. ++ * Disable VMX and clear CR4.VMXE (even if VMXOFF faults) ++ * ++ * Note, VMXOFF causes a #UD if the CPU is !post-VMXON, but it's impossible to ++ * atomically track post-VMXON state, e.g. this may be called in NMI context. ++ * Eat all faults as all other faults on VMXOFF faults are mode related, i.e. ++ * faults are guaranteed to be due to the !post-VMXON check unless the CPU is ++ * magically in RM, VM86, compat mode, or at CPL>0. + */ + static inline void cpu_vmxoff(void) + { +- asm volatile (ASM_VMX_VMXOFF : : : "cc"); ++ asm_volatile_goto("1: vmxoff\n\t" ++ _ASM_EXTABLE(1b, %l[fault]) :::: fault); ++fault: + cr4_clear_bits(X86_CR4_VMXE); + } + diff --git a/patches.suse/x86-virt-mark-flags-and-memory-as-clobbered-by-vmxoff.patch b/patches.suse/x86-virt-mark-flags-and-memory-as-clobbered-by-vmxoff.patch new file mode 100644 index 0000000..c4a667b --- /dev/null +++ b/patches.suse/x86-virt-mark-flags-and-memory-as-clobbered-by-vmxoff.patch @@ -0,0 +1,52 @@ +From: "David P. Reed" +Date: Wed, 30 Dec 2020 16:26:56 -0800 +Subject: x86/virt: Mark flags and memory as clobbered by VMXOFF +Git-commit: 53666664a3052e4ea3ddcb183460dfbc30f1d056 +Patch-mainline: v5.12-rc1 +References: git-fixes + +Explicitly tell the compiler that VMXOFF modifies flags (like all VMX +instructions), and mark memory as clobbered since VMXOFF must not be +reordered and also may have memory side effects (though the kernel +really shouldn't be accessing the root VMCS anyways). + +Practically speaking, adding the clobbers is most likely a nop; the +primary motivation is to properly document VMXOFF's behavior. + +For the flags clobber, both Clang and GCC automatically mark flags as +clobbered; this is noted in commit 4b1e54786e48 ("KVM/x86: Use assembly +instruction mnemonics instead of .byte streams"), which intentionally +removed the previous clobber. But, neither Clang nor GCC documents +this behavior, and there's no downside to including the clobber. + +For the memory clobber, the RFLAGS.IF and CR4.VMXE manipulations that +immediately follow VMXOFF have compiler barriers of their own, i.e. +VMXOFF can't get reordered after clearing CR4.VMXE, which is really +what's of interest. + +Cc: Randy Dunlap +Signed-off-by: David P. Reed +[sean: rewrote changelog, dropped comment adjustments] +Signed-off-by: Sean Christopherson +Message-Id: <20201231002702.2223707-4-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Acked-by: Nikolay Borisov +--- + arch/x86/include/asm/virtext.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h +index fda3e7747c22..2cc585467667 100644 +--- a/arch/x86/include/asm/virtext.h ++++ b/arch/x86/include/asm/virtext.h +@@ -44,7 +44,8 @@ static inline int cpu_has_vmx(void) + static inline void cpu_vmxoff(void) + { + asm_volatile_goto("1: vmxoff\n\t" +- _ASM_EXTABLE(1b, %l[fault]) :::: fault); ++ _ASM_EXTABLE(1b, %l[fault]) ++ ::: "cc", "memory" : fault); + fault: + cr4_clear_bits(X86_CR4_VMXE); + } + diff --git a/series.conf b/series.conf index 46c0828..682b5a8 100644 --- a/series.conf +++ b/series.conf @@ -59088,6 +59088,7 @@ patches.suse/x86-mm-ident_map-check-for-errors-from-ident_pud_init.patch patches.suse/s390-cio-fix-use-after-free-in-ccw_device_destroy_console patches.suse/s390-smp-perform-initial-cpu-reset-also-for-smt-siblings + patches.suse/x86-kprobes-restore-btf-if-the-single-stepping-is-cancelled.patch patches.suse/x86-apic-Fix-x2apic-enablement-without-interrupt-rem.patch patches.suse/x86-msi-Only-use-high-bits-of-MSI-address-for-DMAR-u.patch patches.suse/x86-ioapic-Handle-Extended-Destination-ID-field-in-R.patch @@ -59735,7 +59736,9 @@ patches.suse/arm64-Extend-workaround-for-erratum-1024718-to-all-versions-of-Cortex-A55.patch patches.suse/msft-hv-2226-Drivers-hv-vmbus-Avoid-use-after-free-in-vmbus_onoff.patch patches.suse/kvm-do-not-assume-pte-is-writable-after-follow_pfn.patch + patches.suse/x86-virt-eat-faults-on-vmxoff-in-reboot-flows.patch patches.suse/x86-reboot-force-all-cpus-to-exit-vmx-root-if-vmx-is-supported.patch + patches.suse/x86-virt-mark-flags-and-memory-as-clobbered-by-vmxoff.patch patches.suse/kvm-use-kvm_pfn_t-for-local-pfn-variable-in-hva_to_p.patch patches.suse/media-v4l-ioctl-Fix-memory-leak-in-video_usercopy.patch patches.suse/media-vsp1-Fix-an-error-handling-path-in-the-probe-f.patch @@ -60286,6 +60289,7 @@ patches.suse/0010-overflow-Correct-check_shl_overflow-comment.patch patches.suse/do_cifs_create-don-t-set-i_mode-of-something-we-had-not-created.patch patches.suse/cifs-have-mkdir-handle-race-with-another-client-sanely.patch + patches.suse/x86-kprobes-fix-to-check-non-boostable-prefixes-correctly.patch patches.suse/s390-disassembler-increase-ebpf-disasm-buffer-size patches.suse/media-ite-cir-check-for-receive-overflow.patch patches.suse/media-omap4iss-return-error-code-when-omap4iss_get-f.patch @@ -61286,6 +61290,7 @@ patches.suse/RDMA-rxe-Use-the-correct-size-of-wqe-when-processing.patch patches.suse/RDMA-rxe-Restore-setting-tot_len-in-the-IPv4-header.patch patches.suse/spi-mediatek-Fix-fifo-transfer.patch + patches.suse/x86-tools-relocs-fix-non-posix-regexp.patch patches.suse/0011-md-raid10-properly-indicate-failure-when-ending-a-fa.patch patches.suse/USB-usbtmc-Fix-RCU-stall-warning.patch patches.suse/USB-serial-ch341-fix-character-loss-at-high-transfer.patch @@ -61311,6 +61316,7 @@ patches.suse/iio-adc-Fix-incorrect-exit-of-for-loop.patch patches.suse/ACPI-NFIT-Fix-support-for-virtual-SPA-ranges.patch patches.suse/scsi-lpfc-Move-initialization-of-phba-poll_list-earl.patch + patches.suse/x86-tools-fix-objdump-version-check-again.patch patches.suse/x86-resctrl-fix-default-monitoring-groups-reporting.patch patches.suse/PCI-MSI-Enable-and-mask-MSI-X-early.patch patches.suse/PCI-MSI-Mask-all-unused-MSI-X-entries.patch @@ -61797,6 +61803,7 @@ patches.suse/ibmvnic-Process-crqs-after-enabling-interrupts.patch patches.suse/ibmvnic-delay-complete.patch patches.suse/Revert-x86-kvm-fix-vcpu-id-indexed-array-sizes.patch + patches.suse/x86-irq-ensure-pi-wakeup-handler-is-unregistered-before-module-unload.patch patches.suse/s390-gmap-validate-VMA-in-__gmap_zap patches.suse/s390-gmap-don-t-unconditionally-call-pte_unmap_unlock-in-__gmap_zap patches.suse/s390-mm-validate-VMA-in-PGSTE-manipulation-functions @@ -62039,6 +62046,7 @@ patches.suse/cgroup-Allocate-cgroup_file_ctx-for-kernfs_open_file-priv.patch patches.suse/cgroup-Use-open-time-cgroup-namespace-for-process-migration-perm-checks.patch patches.suse/arm64-clear_page-shouldn-t-use-DC-ZVA-when-DCZID_EL0.DZP-1.patch + patches.suse/x86-mce-inject-avoid-out-of-bounds-write-when-setting-flags.patch patches.suse/random-fix-data-race-on-crng_node_pool.patch patches.suse/random-fix-crash-on-multiple-early-calls-to-add_bootloader_randomness.patch patches.suse/media-em28xx-fix-memory-leak-in-em28xx_init_dev.patch @@ -62531,6 +62539,7 @@ patches.suse/SUNRPC-Ensure-gss-proxy-connects-on-setup.patch patches.suse/Revert-SUNRPC-attempt-AF_LOCAL-connect-on-setup.patch patches.suse/floppy-use-a-statically-allocated-error-counter.patch + patches.suse/x86-fpu-prevent-fpu-state-corruption.patch patches.suse/writeback-Avoid-skipping-inode-writeback-846a3351ddfe.patch patches.suse/cgroup-cpuset-Remove-cpus_allowed-mems_allowed-setup-in-cpuset_init_smp.patch patches.suse/s390-ctcm-fix-variable-dereferenced-before-check @@ -63162,6 +63171,7 @@ patches.suse/ipv6-raw-Deduct-extension-header-length-in-rawv6_pus.patch patches.suse/arm64-cmpxchg_double-hazard-against-entire-exchange-variable.patch patches.suse/ALSA-pcm-Move-rwsem-lock-inside-snd_ctl_elem_read-to.patch + patches.suse/x86-boot-avoid-using-intel-mnemonics-in-at-t-syntax-asm.patch patches.suse/HID-check-empty-report_list-in-hid_validate_values.patch patches.suse/HID-betop-check-shape-of-output-reports.patch patches.suse/net-usb-sr9700-Handle-negative-len.patch @@ -63183,6 +63193,7 @@ patches.suse/block-bio-integrity-Copy-flags-when-bio_integrity_pa.patch patches.suse/powercap-fix-possible-name-leak-in-powercap_register.patch patches.suse/arm64-cpufeature-Fix-field-sign-for-DIT-hwcap-detection.patch + patches.suse/crypto-x86-ghash-fix-unaligned-access-in-ghash_setkey.patch patches.suse/net-add-sock_init_data_uid.patch patches.suse/tun-tun_chr_open-correctly-initialize-socket-uid.patch patches.suse/tap-tap_open-correctly-initialize-socket-uid.patch