tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: avoid spinning processes when catching SEGV/BUS/FPE



In article <20171207074102.GC19249%mail.duskware.de@localhost>,
Martin Husemann  <martin%duskware.de@localhost> wrote:
>On Wed, Dec 06, 2017 at 06:22:48PM -0500, Christos Zoulas wrote:
>> This has also the unfortunate side effect that makes the problem
>> undebuggable (aside from wasting CPU resources). The following patch
>> fixes that.
>
>Been there, tried to debug that - evil!
>
>Could we auto-restore the signal handler when it returns? We would seriously
>alter behaviour for many apps otherwise, won't we?
>
>But maybe I misread your patch.

Restoration to SIGDFL happens only when:

    1. the signal is a trap signal (SEGV,BUS,FPE)
and
    2. delivered through the trap path (not kill)
and
    3. the process is not traced (debugged processes are not affected)
and
    4. the signal is caught by the user (user specified a handler)
and
    5. the signal is being masked so it will not get delivered to the user
       handler. This typically happens when there is a second fault inside
       the signal handler. While the user can mask the signal before it
       happens, this typically does not happen. If we ever find a program
       that needs this specific treatment we can change the code it then
       (perhaps via a special sigaction flag -- I know what I am doing).
       I don't want to add more complexity to the code for situations that
       simply don't come up in real life.

christos



Home | Main Index | Thread Index | Old Index