Skip to content
  • Eric W. Biederman's avatar
    530621b7
    signal/um: More carefully relay signals in relay_signal. · 530621b7
    Eric W. Biederman authored
    
    
    There is a bug in relay signal.  It assumes that when a signal is
    relayed the signal never uses a signal independent si_code, such
    as SI_USER, SI_KERNEL, SI_QUEUE, ... SI_SIGIO etc.  In practice
    siginfo was assuming it was relaying a signal with the SIL_FAULT
    layout.  As that is the common cases for the signals it supported
    that is a reasonable assumption.
    
    Further user mode linux must be very careful when relaying different
    kinds of signals to prevent an information leak.  This means simply
    increasing the kinds of signals that are handled in relay_signal
    is non-trivial.
    
    Therefore use siginfo_layout and force_sig_fault to simplify
    the signal relaying in relay_signal.
    
    By taking advantage of the fact that user mode linux only works
    on x86 and x86_64 we can assume that si_trapno can be ignored,
    and that si_errno is always zero.
    
    For the signals SIGLL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP the only
    fault handler I know of that sets si_errno is SIGTRAP TRAP_HWBKPT on a
    few oddball architectures.  Those architectures have been modified to
    use force_sig_ptrace_errno_trap.
    
    Similarly only a few architectures set __ARCH_SI_TRAPNO.
    
    At the point uml supports those architectures again these additional
    cases can be examined and supported if desired in relay_signal.
    
    Cc: Jeff Dike <jdike@addtoit.com>
    Cc: Richard Weinberger <richard@nod.at>
    Cc: Anton Ivanov <anton.ivanov@kot-begemot.co.uk>
    Cc: Martin Pärtel <martin.partel@gmail.com>
    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: linux-um@lists.infradead.org
    Fixes: d3c1cfcd ("um: pass siginfo to guest process")
    Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
    530621b7
    signal/um: More carefully relay signals in relay_signal.
    Eric W. Biederman authored
    
    
    There is a bug in relay signal.  It assumes that when a signal is
    relayed the signal never uses a signal independent si_code, such
    as SI_USER, SI_KERNEL, SI_QUEUE, ... SI_SIGIO etc.  In practice
    siginfo was assuming it was relaying a signal with the SIL_FAULT
    layout.  As that is the common cases for the signals it supported
    that is a reasonable assumption.
    
    Further user mode linux must be very careful when relaying different
    kinds of signals to prevent an information leak.  This means simply
    increasing the kinds of signals that are handled in relay_signal
    is non-trivial.
    
    Therefore use siginfo_layout and force_sig_fault to simplify
    the signal relaying in relay_signal.
    
    By taking advantage of the fact that user mode linux only works
    on x86 and x86_64 we can assume that si_trapno can be ignored,
    and that si_errno is always zero.
    
    For the signals SIGLL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP the only
    fault handler I know of that sets si_errno is SIGTRAP TRAP_HWBKPT on a
    few oddball architectures.  Those architectures have been modified to
    use force_sig_ptrace_errno_trap.
    
    Similarly only a few architectures set __ARCH_SI_TRAPNO.
    
    At the point uml supports those architectures again these additional
    cases can be examined and supported if desired in relay_signal.
    
    Cc: Jeff Dike <jdike@addtoit.com>
    Cc: Richard Weinberger <richard@nod.at>
    Cc: Anton Ivanov <anton.ivanov@kot-begemot.co.uk>
    Cc: Martin Pärtel <martin.partel@gmail.com>
    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: linux-um@lists.infradead.org
    Fixes: d3c1cfcd ("um: pass siginfo to guest process")
    Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Loading