Skip to content

Commit 95bf9d6

Browse files
committed
signal/mips: Update (_save|_restore)_fp_context to fail with -EFAULT
When an instruction to save or restore a register from the stack fails in _save_fp_context or _restore_fp_context return with -EFAULT. This change was made to r2300_fpu.S[1] but it looks like it got lost with the introduction of EX2[2]. This is also what the other implementation of _save_fp_context and _restore_fp_context in r4k_fpu.S does, and what is needed for the callers to be able to handle the error. Furthermore calling do_exit(SIGSEGV) from bad_stack is wrong because it does not terminate the entire process it just terminates a single thread. As the changed code was the only caller of arch/mips/kernel/syscall.c:bad_stack remove the problematic and now unused helper function. Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Maciej Rozycki <macro@orcam.me.uk> Cc: linux-mips@vger.kernel.org [1] 35938a0 ("MIPS: Fix ISA I FP sigcontext access violation handling") [2] f92722d ("MIPS: Correct MIPS I FP sigcontext layout") Cc: stable@vger.kernel.org Fixes: f92722d ("MIPS: Correct MIPS I FP sigcontext layout") Acked-by: Maciej W. Rozycki <macro@orcam.me.uk> Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Link: https://lkml.kernel.org/r/20211020174406.17889-5-ebiederm@xmission.com Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
1 parent 97cae84 commit 95bf9d6

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

‎arch/mips/kernel/r2300_fpu.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
#define EX2(a,b) \
3030
9: a,##b; \
3131
.section __ex_table,"a"; \
32-
PTR 9b,bad_stack; \
33-
PTR 9b+4,bad_stack; \
32+
PTR 9b,fault; \
33+
PTR 9b+4,fault; \
3434
.previous
3535

3636
.set mips1

‎arch/mips/kernel/syscall.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,3 @@ SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op)
240240
{
241241
return -ENOSYS;
242242
}
243-
244-
/*
245-
* If we ever come here the user sp is bad. Zap the process right away.
246-
* Due to the bad stack signaling wouldn't work.
247-
*/
248-
asmlinkage void bad_stack(void)
249-
{
250-
do_exit(SIGSEGV);
251-
}

0 commit comments

Comments
 (0)