Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1706673

Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with SIGFPE

From ebiederm@xmission.com (Eric W. Biederman)
Newsgroups linux.kernel
Subject Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with SIGFPE
Date 2017-08-08 17:40 +0200
Message-ID <uceLW-1Xt-67@gated-at.bofh.it> (permalink)
References <u4BvX-3ta-9@gated-at.bofh.it> <u4BvY-3ta-25@gated-at.bofh.it> <ubSV7-2zz-87@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


"Maciej W. Rozycki" <macro@imgtec.com> writes:

> On Tue, 18 Jul 2017, Eric W. Biederman wrote:
>
>> diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
>> index b68b4d0726d3..6c9cca9c5341 100644
>> --- a/arch/mips/kernel/traps.c
>> +++ b/arch/mips/kernel/traps.c
>> @@ -735,7 +735,7 @@ void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
>>  	else if (fcr31 & FPU_CSR_INE_X)
>>  		si.si_code = FPE_FLTRES;
>>  	else
>> -		si.si_code = __SI_FAULT;
>> +		si.si_code = FPE_FIXME;
>
>  This is an "impossible" state to reach unless your hardware is on fire.  
> One or more of the FCSR Cause bits will have been set (in `fcr31') or the 
> FPE exception would not have happened.
>
>  Of course there could be a simulator bug, or we could have breakage 
> somewhere causing `process_fpemu_return' to be called with SIGFPE and 
> inconsistent `fcr31'.  So we need to handle it somehow.
>
>  So what would be the right value of `si_code' to use here for such an 
> unexpected exception condition?  I think `BUG()' would be too big a 
> hammer here.  Or wouldn't it?

The possible solutions I can think of are:

WARN_ON_ONCE with a comment.

Add a new si_code to uapi/asm-generic/siginfo.h perhaps FPE_IMPOSSIBLE.
Like syscall numbers si_codes are cheap.

Call force_sig() instead of force_sig_info, using just a generic
si_code.

If this is truly impossible and the compiler doesn't complain just drop
the code.

Eric

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with  SIGFPE "Maciej W. Rozycki" <macro@imgtec.com> - 2017-08-07 18:20 +0200
  Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with SIGFPE Linus Torvalds <torvalds@linux-foundation.org> - 2017-08-07 19:50 +0200
    Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with  SIGFPE Ralf Baechle <ralf@linux-mips.org> - 2017-08-07 22:00 +0200
  Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with SIGFPE ebiederm@xmission.com (Eric W. Biederman) - 2017-08-08 17:40 +0200
    Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with  SIGFPE "Maciej W. Rozycki" <macro@imgtec.com> - 2017-08-09 01:20 +0200

csiph-web