• Linus Torvalds's avatar
    signal handling: don't use BUG_ON() for debugging · a382f8fe
    Linus Torvalds authored
    These are indeed "should not happen" situations, but it turns out recent
    changes made the 'task_is_stopped_or_trace()' case trigger (fix for that
    exists, is pending more testing), and the BUG_ON() makes it
    unnecessarily hard to actually debug for no good reason.
    
    It's been that way for a long time, but let's make it clear: BUG_ON() is
    not good for debugging, and should never be used in situations where you
    could just say "this shouldn't happen, but we can continue".
    
    Use WARN_ON_ONCE() instead to make sure it gets logged, and then just
    continue running.  Instead of making the system basically unusuable
    because you crashed the machine while potentially holding some very core
    locks (eg this function is commonly called while holding 'tasklist_lock'
    for writing).
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    a382f8fe
signal.c 123 KB