Skip to content

Commit e723e3f

Browse files
Maciej W. Rozyckiralfbaechle
authored andcommitted
MIPS: traps: Fix SIGFPE information leak from do_ov' and do_trap_or_bp'
Avoid sending a partially initialised `siginfo_t' structure along SIGFPE signals issued from `do_ov' and `do_trap_or_bp', leading to information leaking from the kernel stack. Signed-off-by: Maciej W. Rozycki <macro@imgtec.com> Cc: stable@vger.kernel.org Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 887349f commit e723e3f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

arch/mips/kernel/traps.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -690,15 +690,15 @@ static int simulate_sync(struct pt_regs *regs, unsigned int opcode)
690690
asmlinkage void do_ov(struct pt_regs *regs)
691691
{
692692
enum ctx_state prev_state;
693-
siginfo_t info;
693+
siginfo_t info = {
694+
.si_signo = SIGFPE,
695+
.si_code = FPE_INTOVF,
696+
.si_addr = (void __user *)regs->cp0_epc,
697+
};
694698

695699
prev_state = exception_enter();
696700
die_if_kernel("Integer overflow", regs);
697701

698-
info.si_code = FPE_INTOVF;
699-
info.si_signo = SIGFPE;
700-
info.si_errno = 0;
701-
info.si_addr = (void __user *) regs->cp0_epc;
702702
force_sig_info(SIGFPE, &info, current);
703703
exception_exit(prev_state);
704704
}
@@ -874,7 +874,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
874874
void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
875875
const char *str)
876876
{
877-
siginfo_t info;
877+
siginfo_t info = { 0 };
878878
char b[40];
879879

880880
#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
@@ -903,7 +903,6 @@ void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
903903
else
904904
info.si_code = FPE_INTOVF;
905905
info.si_signo = SIGFPE;
906-
info.si_errno = 0;
907906
info.si_addr = (void __user *) regs->cp0_epc;
908907
force_sig_info(SIGFPE, &info, current);
909908
break;

0 commit comments

Comments
 (0)