]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Mar 2022 10:07:14 +0000 (11:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Mar 2022 10:07:14 +0000 (11:07 +0100)
added patches:
x86-module-fix-the-paravirt-vs-alternative-order.patch

queue-5.15/series
queue-5.15/x86-module-fix-the-paravirt-vs-alternative-order.patch [new file with mode: 0644]

index 742d036bbde8626d50934b5b086f4cc090daeb9c..bb4e2953e2b9a9b71d6748b78910fff82c4f37e1 100644 (file)
@@ -21,3 +21,4 @@ tcp-make-tcp_read_sock-more-robust.patch
 sfc-extend-the-locking-on-mcdi-seqno.patch
 bnx2-fix-an-error-message.patch
 kselftest-vm-fix-tests-build-with-old-libc.patch
+x86-module-fix-the-paravirt-vs-alternative-order.patch
diff --git a/queue-5.15/x86-module-fix-the-paravirt-vs-alternative-order.patch b/queue-5.15/x86-module-fix-the-paravirt-vs-alternative-order.patch
new file mode 100644 (file)
index 0000000..25799c9
--- /dev/null
@@ -0,0 +1,56 @@
+From 5adf349439d29f92467e864f728dfc23180f3ef9 Mon Sep 17 00:00:00 2001
+From: Peter Zijlstra <peterz@infradead.org>
+Date: Thu, 3 Mar 2022 12:23:23 +0100
+Subject: x86/module: Fix the paravirt vs alternative order
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+commit 5adf349439d29f92467e864f728dfc23180f3ef9 upstream.
+
+Ever since commit
+
+  4e6292114c74 ("x86/paravirt: Add new features for paravirt patching")
+
+there is an ordering dependency between patching paravirt ops and
+patching alternatives, the module loader still violates this.
+
+Fixes: 4e6292114c74 ("x86/paravirt: Add new features for paravirt patching")
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Miroslav Benes <mbenes@suse.cz>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20220303112825.068773913@infradead.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/module.c |   13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/arch/x86/kernel/module.c
++++ b/arch/x86/kernel/module.c
+@@ -270,6 +270,14 @@ int module_finalize(const Elf_Ehdr *hdr,
+                       orc_ip = s;
+       }
++      /*
++       * See alternative_instructions() for the ordering rules between the
++       * various patching types.
++       */
++      if (para) {
++              void *pseg = (void *)para->sh_addr;
++              apply_paravirt(pseg, pseg + para->sh_size);
++      }
+       if (alt) {
+               /* patch .altinstructions */
+               void *aseg = (void *)alt->sh_addr;
+@@ -283,11 +291,6 @@ int module_finalize(const Elf_Ehdr *hdr,
+                                           tseg, tseg + text->sh_size);
+       }
+-      if (para) {
+-              void *pseg = (void *)para->sh_addr;
+-              apply_paravirt(pseg, pseg + para->sh_size);
+-      }
+-
+       /* make jump label nops */
+       jump_label_apply_nops(me);