]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 May 2023 02:33:57 +0000 (11:33 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 May 2023 02:33:57 +0000 (11:33 +0900)
added patches:
crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch
kvm-nvmx-emulate-nops-in-l2-and-pause-if-it-s-not-intercepted.patch
pwm-meson-fix-axg-ao-mux-parents.patch
reiserfs-add-security-prefix-to-xattr-name-in-reiserfs_security_write.patch
ring-buffer-sync-irq-works-before-buffer-destruction.patch

queue-4.19/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch [new file with mode: 0644]
queue-4.19/kvm-nvmx-emulate-nops-in-l2-and-pause-if-it-s-not-intercepted.patch [new file with mode: 0644]
queue-4.19/pwm-meson-fix-axg-ao-mux-parents.patch [new file with mode: 0644]
queue-4.19/reiserfs-add-security-prefix-to-xattr-name-in-reiserfs_security_write.patch [new file with mode: 0644]
queue-4.19/ring-buffer-sync-irq-works-before-buffer-destruction.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch b/queue-4.19/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch
new file mode 100644 (file)
index 0000000..7f82a79
--- /dev/null
@@ -0,0 +1,45 @@
+From a543ada7db729514ddd3ba4efa45f4c7b802ad85 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com>
+Date: Mon, 13 Mar 2023 10:17:24 +0100
+Subject: crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Toke Høiland-Jørgensen <toke@redhat.com>
+
+commit a543ada7db729514ddd3ba4efa45f4c7b802ad85 upstream.
+
+The crypto_unregister_alg() function expects callers to ensure that any
+algorithm that is unregistered has a refcnt of exactly 1, and issues a
+BUG_ON() if this is not the case. However, there are in fact drivers that
+will call crypto_unregister_alg() without ensuring that the refcnt has been
+lowered first, most notably on system shutdown. This causes the BUG_ON() to
+trigger, which prevents a clean shutdown and hangs the system.
+
+To avoid such hangs on shutdown, demote the BUG_ON() in
+crypto_unregister_alg() to a WARN_ON() with early return. Cc stable because
+this problem was observed on a 6.2 kernel, cf the link below.
+
+Link: https://lore.kernel.org/r/87r0tyq8ph.fsf@toke.dk
+Cc: stable@vger.kernel.org
+Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ crypto/algapi.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/crypto/algapi.c
++++ b/crypto/algapi.c
+@@ -419,7 +419,9 @@ int crypto_unregister_alg(struct crypto_
+       if (ret)
+               return ret;
+-      BUG_ON(refcount_read(&alg->cra_refcnt) != 1);
++      if (WARN_ON(refcount_read(&alg->cra_refcnt) != 1))
++              return;
++
+       if (alg->cra_destroy)
+               alg->cra_destroy(alg);
diff --git a/queue-4.19/kvm-nvmx-emulate-nops-in-l2-and-pause-if-it-s-not-intercepted.patch b/queue-4.19/kvm-nvmx-emulate-nops-in-l2-and-pause-if-it-s-not-intercepted.patch
new file mode 100644 (file)
index 0000000..793dba6
--- /dev/null
@@ -0,0 +1,68 @@
+From 4984563823f0034d3533854c1b50e729f5191089 Mon Sep 17 00:00:00 2001
+From: Sean Christopherson <seanjc@google.com>
+Date: Tue, 4 Apr 2023 17:23:59 -0700
+Subject: KVM: nVMX: Emulate NOPs in L2, and PAUSE if it's not intercepted
+
+From: Sean Christopherson <seanjc@google.com>
+
+commit 4984563823f0034d3533854c1b50e729f5191089 upstream.
+
+Extend VMX's nested intercept logic for emulated instructions to handle
+"pause" interception, in quotes because KVM's emulator doesn't filter out
+NOPs when checking for nested intercepts.  Failure to allow emulation of
+NOPs results in KVM injecting a #UD into L2 on any NOP that collides with
+the emulator's definition of PAUSE, i.e. on all single-byte NOPs.
+
+For PAUSE itself, honor L1's PAUSE-exiting control, but ignore PLE to
+avoid unnecessarily injecting a #UD into L2.  Per the SDM, the first
+execution of PAUSE after VM-Entry is treated as the beginning of a new
+loop, i.e. will never trigger a PLE VM-Exit, and so L1 can't expect any
+given execution of PAUSE to deterministically exit.
+
+  ... the processor considers this execution to be the first execution of
+  PAUSE in a loop. (It also does so for the first execution of PAUSE at
+  CPL 0 after VM entry.)
+
+All that said, the PLE side of things is currently a moot point, as KVM
+doesn't expose PLE to L1.
+
+Note, vmx_check_intercept() is still wildly broken when L1 wants to
+intercept an instruction, as KVM injects a #UD instead of synthesizing a
+nested VM-Exit.  That issue extends far beyond NOP/PAUSE and needs far
+more effort to fix, i.e. is a problem for the future.
+
+Fixes: 07721feee46b ("KVM: nVMX: Don't emulate instructions in guest mode")
+Cc: Mathias Krause <minipli@grsecurity.net>
+Cc: stable@vger.kernel.org
+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
+Link: https://lore.kernel.org/r/20230405002359.418138-1-seanjc@google.com
+Signed-off-by: Sean Christopherson <seanjc@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/vmx/vmx.c |   15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+--- a/arch/x86/kvm/vmx/vmx.c
++++ b/arch/x86/kvm/vmx/vmx.c
+@@ -13878,6 +13878,21 @@ static int vmx_check_intercept(struct kv
+               /* FIXME: produce nested vmexit and return X86EMUL_INTERCEPTED.  */
+               break;
++      case x86_intercept_pause:
++              /*
++               * PAUSE is a single-byte NOP with a REPE prefix, i.e. collides
++               * with vanilla NOPs in the emulator.  Apply the interception
++               * check only to actual PAUSE instructions.  Don't check
++               * PAUSE-loop-exiting, software can't expect a given PAUSE to
++               * exit, i.e. KVM is within its rights to allow L2 to execute
++               * the PAUSE.
++               */
++              if ((info->rep_prefix != REPE_PREFIX) ||
++                  !nested_cpu_has2(vmcs12, CPU_BASED_PAUSE_EXITING))
++                      return X86EMUL_CONTINUE;
++
++              break;
++
+       /* TODO: check more intercepts... */
+       default:
+               break;
diff --git a/queue-4.19/pwm-meson-fix-axg-ao-mux-parents.patch b/queue-4.19/pwm-meson-fix-axg-ao-mux-parents.patch
new file mode 100644 (file)
index 0000000..0661daa
--- /dev/null
@@ -0,0 +1,36 @@
+From eb411c0cf59ae6344b34bc6f0d298a22b300627e Mon Sep 17 00:00:00 2001
+From: Heiner Kallweit <hkallweit1@gmail.com>
+Date: Sun, 9 Apr 2023 17:15:52 +0200
+Subject: pwm: meson: Fix axg ao mux parents
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+commit eb411c0cf59ae6344b34bc6f0d298a22b300627e upstream.
+
+This fix is basically the same as 9bce02ef0dfa ("pwm: meson: Fix the
+G12A AO clock parents order"). Vendor driver referenced there has
+xtal as first parent also for axg ao. In addition fix the name
+of the aoclk81 clock. Apparently name aoclk81 as used by the vendor
+driver was changed when mainlining the axg clock driver.
+
+Fixes: bccaa3f917c9 ("pwm: meson: Add clock source configuration for Meson-AXG")
+Cc: stable@vger.kernel.org
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pwm/pwm-meson.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/pwm/pwm-meson.c
++++ b/drivers/pwm/pwm-meson.c
+@@ -425,7 +425,7 @@ static const struct meson_pwm_data pwm_a
+ };
+ static const char * const pwm_axg_ao_parent_names[] = {
+-      "aoclk81", "xtal", "fclk_div4", "fclk_div5"
++      "xtal", "axg_ao_clk81", "fclk_div4", "fclk_div5"
+ };
+ static const struct meson_pwm_data pwm_axg_ao_data = {
diff --git a/queue-4.19/reiserfs-add-security-prefix-to-xattr-name-in-reiserfs_security_write.patch b/queue-4.19/reiserfs-add-security-prefix-to-xattr-name-in-reiserfs_security_write.patch
new file mode 100644 (file)
index 0000000..aadc1da
--- /dev/null
@@ -0,0 +1,54 @@
+From d82dcd9e21b77d338dc4875f3d4111f0db314a7c Mon Sep 17 00:00:00 2001
+From: Roberto Sassu <roberto.sassu@huawei.com>
+Date: Fri, 31 Mar 2023 14:32:18 +0200
+Subject: reiserfs: Add security prefix to xattr name in reiserfs_security_write()
+
+From: Roberto Sassu <roberto.sassu@huawei.com>
+
+commit d82dcd9e21b77d338dc4875f3d4111f0db314a7c upstream.
+
+Reiserfs sets a security xattr at inode creation time in two stages: first,
+it calls reiserfs_security_init() to obtain the xattr from active LSMs;
+then, it calls reiserfs_security_write() to actually write that xattr.
+
+Unfortunately, it seems there is a wrong expectation that LSMs provide the
+full xattr name in the form 'security.<suffix>'. However, LSMs always
+provided just the suffix, causing reiserfs to not write the xattr at all
+(if the suffix is shorter than the prefix), or to write an xattr with the
+wrong name.
+
+Add a temporary buffer in reiserfs_security_write(), and write to it the
+full xattr name, before passing it to reiserfs_xattr_set_handle().
+
+Also replace the name length check with a check that the full xattr name is
+not larger than XATTR_NAME_MAX.
+
+Cc: stable@vger.kernel.org # v2.6.x
+Fixes: 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes during inode creation")
+Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
+Signed-off-by: Paul Moore <paul@paul-moore.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/reiserfs/xattr_security.c |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/fs/reiserfs/xattr_security.c
++++ b/fs/reiserfs/xattr_security.c
+@@ -81,11 +81,15 @@ int reiserfs_security_write(struct reise
+                           struct inode *inode,
+                           struct reiserfs_security_handle *sec)
+ {
++      char xattr_name[XATTR_NAME_MAX + 1] = XATTR_SECURITY_PREFIX;
+       int error;
+-      if (strlen(sec->name) < sizeof(XATTR_SECURITY_PREFIX))
++
++      if (XATTR_SECURITY_PREFIX_LEN + strlen(sec->name) > XATTR_NAME_MAX)
+               return -EINVAL;
+-      error = reiserfs_xattr_set_handle(th, inode, sec->name, sec->value,
++      strlcat(xattr_name, sec->name, sizeof(xattr_name));
++
++      error = reiserfs_xattr_set_handle(th, inode, xattr_name, sec->value,
+                                         sec->length, XATTR_CREATE);
+       if (error == -ENODATA || error == -EOPNOTSUPP)
+               error = 0;
diff --git a/queue-4.19/ring-buffer-sync-irq-works-before-buffer-destruction.patch b/queue-4.19/ring-buffer-sync-irq-works-before-buffer-destruction.patch
new file mode 100644 (file)
index 0000000..9b49d84
--- /dev/null
@@ -0,0 +1,94 @@
+From 675751bb20634f981498c7d66161584080cc061e Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Thu, 27 Apr 2023 17:59:20 +0200
+Subject: ring-buffer: Sync IRQ works before buffer destruction
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+commit 675751bb20634f981498c7d66161584080cc061e upstream.
+
+If something was written to the buffer just before destruction,
+it may be possible (maybe not in a real system, but it did
+happen in ARCH=um with time-travel) to destroy the ringbuffer
+before the IRQ work ran, leading this KASAN report (or a crash
+without KASAN):
+
+    BUG: KASAN: slab-use-after-free in irq_work_run_list+0x11a/0x13a
+    Read of size 8 at addr 000000006d640a48 by task swapper/0
+
+    CPU: 0 PID: 0 Comm: swapper Tainted: G        W  O       6.3.0-rc1 #7
+    Stack:
+     60c4f20f 0c203d48 41b58ab3 60f224fc
+     600477fa 60f35687 60c4f20f 601273dd
+     00000008 6101eb00 6101eab0 615be548
+    Call Trace:
+     [<60047a58>] show_stack+0x25e/0x282
+     [<60c609e0>] dump_stack_lvl+0x96/0xfd
+     [<60c50d4c>] print_report+0x1a7/0x5a8
+     [<603078d3>] kasan_report+0xc1/0xe9
+     [<60308950>] __asan_report_load8_noabort+0x1b/0x1d
+     [<60232844>] irq_work_run_list+0x11a/0x13a
+     [<602328b4>] irq_work_tick+0x24/0x34
+     [<6017f9dc>] update_process_times+0x162/0x196
+     [<6019f335>] tick_sched_handle+0x1a4/0x1c3
+     [<6019fd9e>] tick_sched_timer+0x79/0x10c
+     [<601812b9>] __hrtimer_run_queues.constprop.0+0x425/0x695
+     [<60182913>] hrtimer_interrupt+0x16c/0x2c4
+     [<600486a3>] um_timer+0x164/0x183
+     [...]
+
+    Allocated by task 411:
+     save_stack_trace+0x99/0xb5
+     stack_trace_save+0x81/0x9b
+     kasan_save_stack+0x2d/0x54
+     kasan_set_track+0x34/0x3e
+     kasan_save_alloc_info+0x25/0x28
+     ____kasan_kmalloc+0x8b/0x97
+     __kasan_kmalloc+0x10/0x12
+     __kmalloc+0xb2/0xe8
+     load_elf_phdrs+0xee/0x182
+     [...]
+
+    The buggy address belongs to the object at 000000006d640800
+     which belongs to the cache kmalloc-1k of size 1024
+    The buggy address is located 584 bytes inside of
+     freed 1024-byte region [000000006d640800, 000000006d640c00)
+
+Add the appropriate irq_work_sync() so the work finishes before
+the buffers are destroyed.
+
+Prior to the commit in the Fixes tag below, there was only a
+single global IRQ work, so this issue didn't exist.
+
+Link: https://lore.kernel.org/linux-trace-kernel/20230427175920.a76159263122.I8295e405c44362a86c995e9c2c37e3e03810aa56@changeid
+
+Cc: stable@vger.kernel.org
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Fixes: 15693458c4bc ("tracing/ring-buffer: Move poll wake ups into ring buffer code")
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/trace/ring_buffer.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/kernel/trace/ring_buffer.c
++++ b/kernel/trace/ring_buffer.c
+@@ -1326,6 +1326,8 @@ static void rb_free_cpu_buffer(struct ri
+       struct list_head *head = cpu_buffer->pages;
+       struct buffer_page *bpage, *tmp;
++      irq_work_sync(&cpu_buffer->irq_work.work);
++
+       free_buffer_page(cpu_buffer->reader_page);
+       if (head) {
+@@ -1431,6 +1433,8 @@ ring_buffer_free(struct ring_buffer *buf
+       cpuhp_state_remove_instance(CPUHP_TRACE_RB_PREPARE, &buffer->node);
++      irq_work_sync(&buffer->irq_work.work);
++
+       for_each_buffer_cpu(buffer, cpu)
+               rb_free_cpu_buffer(buffer->buffers[cpu]);
index 935f6c645e179951727f43d62013a9318e1938a3..8df51128bc6bb7cf5c1f3bae085cff3a94769b58 100644 (file)
@@ -11,3 +11,8 @@ staging-iio-resolver-ads1210-fix-config-mode.patch
 xhci-fix-debugfs-register-accesses-while-suspended.patch
 mips-fw-allow-firmware-to-pass-a-empty-env.patch
 ipmi-fix-ssif-not-responding-under-certain-cond.patch
+pwm-meson-fix-axg-ao-mux-parents.patch
+ring-buffer-sync-irq-works-before-buffer-destruction.patch
+crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch
+reiserfs-add-security-prefix-to-xattr-name-in-reiserfs_security_write.patch
+kvm-nvmx-emulate-nops-in-l2-and-pause-if-it-s-not-intercepted.patch