Skip to content

Commit 14a270b

Browse files
AndybnACTpalmer-dabbelt
authored andcommitted
riscv: signal: fix sigaltstack frame size checking
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: 8ee0b41 ("riscv: signal: Add sigcontext save/restore for vector") Reported-by: Prashanth Swaminathan <[email protected]> Signed-off-by: Andy Chiu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 5abb5c3 commit 14a270b

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

arch/riscv/kernel/signal.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,6 @@ static inline void __user *get_sigframe(struct ksignal *ksig,
311311
/* Align the stack frame. */
312312
sp &= ~0xfUL;
313313

314-
/*
315-
* Fail if the size of the altstack is not large enough for the
316-
* sigframe construction.
317-
*/
318-
if (current->sas_ss_size && sp < current->sas_ss_sp)
319-
return (void __user __force *)-1UL;
320-
321314
return (void __user *)sp;
322315
}
323316

0 commit comments

Comments
 (0)