signal/unicore32: Use FPE_FLTUNK instead of 0 in ucf64_raise_sigfpe
The si_code of 0 (aka SI_USER) has fields si_pid and si_uid not
si_addr so it so only by luck would the appropriate fields by copied
to userspace by copy_siginfo_to_user.
This is just broken and wrong.
Make it obvious what is happening by moving the si_code from a
parameter of the one call to ucf64_raise_sigfpe to a constant value
that info.si_code gets set to.
Explicitly set the si_code to FPE_FLTUNK the newly reserved floating
point si_code for an unknown floating point exception.
It looks like there is a fair chance that this is a code path that has
never been used in real life on unicore32. The bad si_code and the
print statement that calls it an unhandled exception. So I really
don't expect anyone will mind if this just gets fixed.
In similar situations on more popular architectures the conclusion was
just fix it.
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Arnd Bergmann <arnd@arndb.de>
Fixes: d9bc15794d
("unicore32 additional architecture files: float point handling")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
aeb1c0f6ff
commit
d8f7f3228a
|
@ -52,14 +52,14 @@
|
||||||
* Raise a SIGFPE for the current process.
|
* Raise a SIGFPE for the current process.
|
||||||
* sicode describes the signal being raised.
|
* sicode describes the signal being raised.
|
||||||
*/
|
*/
|
||||||
void ucf64_raise_sigfpe(unsigned int sicode, struct pt_regs *regs)
|
void ucf64_raise_sigfpe(struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
siginfo_t info;
|
siginfo_t info;
|
||||||
|
|
||||||
clear_siginfo(&info);
|
clear_siginfo(&info);
|
||||||
|
|
||||||
info.si_signo = SIGFPE;
|
info.si_signo = SIGFPE;
|
||||||
info.si_code = sicode;
|
info.si_code = FPE_FLTUNK;
|
||||||
info.si_addr = (void __user *)(instruction_pointer(regs) - 4);
|
info.si_addr = (void __user *)(instruction_pointer(regs) - 4);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -94,7 +94,7 @@ void ucf64_exchandler(u32 inst, u32 fpexc, struct pt_regs *regs)
|
||||||
pr_debug("UniCore-F64 FPSCR 0x%08x INST 0x%08x\n",
|
pr_debug("UniCore-F64 FPSCR 0x%08x INST 0x%08x\n",
|
||||||
cff(FPSCR), inst);
|
cff(FPSCR), inst);
|
||||||
|
|
||||||
ucf64_raise_sigfpe(0, regs);
|
ucf64_raise_sigfpe(regs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue