]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.5-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 15 Oct 2023 17:56:46 +0000 (19:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 15 Oct 2023 17:56:46 +0000 (19:56 +0200)
added patches:
riscv-signal-fix-sigaltstack-frame-size-checking.patch

queue-6.5/riscv-signal-fix-sigaltstack-frame-size-checking.patch [new file with mode: 0644]
queue-6.5/series

diff --git a/queue-6.5/riscv-signal-fix-sigaltstack-frame-size-checking.patch b/queue-6.5/riscv-signal-fix-sigaltstack-frame-size-checking.patch
new file mode 100644 (file)
index 0000000..ae55c40
--- /dev/null
@@ -0,0 +1,47 @@
+From 14a270bfab7ab1c4b605c01eeca5557447ad5a2b Mon Sep 17 00:00:00 2001
+From: Andy Chiu <andy.chiu@sifive.com>
+Date: Tue, 22 Aug 2023 16:49:03 +0000
+Subject: riscv: signal: fix sigaltstack frame size checking
+
+From: Andy Chiu <andy.chiu@sifive.com>
+
+commit 14a270bfab7ab1c4b605c01eeca5557447ad5a2b upstream.
+
+The alternative stack checking in get_sigframe introduced by the Vector
+support is not needed and has a problem. It is not needed as we have
+already validate it at the beginning of the function if we are already
+on an altstack. If not, the size of an altstack is always validated at
+its allocation stage with sigaltstack_size_valid().
+
+Besides, we must only regard the size of an altstack if the handler of a
+signal is registered with SA_ONSTACK. So, blindly checking overflow of
+an altstack if sas_ss_size not equals to zero will check against wrong
+signal handlers if only a subset of signals are registered with
+SA_ONSTACK.
+
+Fixes: 8ee0b41898fa ("riscv: signal: Add sigcontext save/restore for vector")
+Reported-by: Prashanth Swaminathan <prashanthsw@google.com>
+Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
+Link: https://lore.kernel.org/r/20230822164904.21660-1-andy.chiu@sifive.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/kernel/signal.c |    7 -------
+ 1 file changed, 7 deletions(-)
+
+--- a/arch/riscv/kernel/signal.c
++++ b/arch/riscv/kernel/signal.c
+@@ -311,13 +311,6 @@ static inline void __user *get_sigframe(
+       /* Align the stack frame. */
+       sp &= ~0xfUL;
+-      /*
+-       * Fail if the size of the altstack is not large enough for the
+-       * sigframe construction.
+-       */
+-      if (current->sas_ss_size && sp < current->sas_ss_sp)
+-              return (void __user __force *)-1UL;
+-
+       return (void __user *)sp;
+ }
index ea6203b135849e27fbd55d35857378ea7b2399f2..29ccabb460a875b0f4811a1aacd273f0cfde8c02 100644 (file)
@@ -89,3 +89,4 @@ octeontx2-pf-fix-page-pool-frag-allocation-warning.patch
 rswitch-fix-renesas_eth_sw_remove-implementation.patch
 rswitch-fix-imbalance-phy_power_off-calling.patch
 workqueue-override-implicit-ordered-attribute-in-wor.patch
+riscv-signal-fix-sigaltstack-frame-size-checking.patch