1. 11 5月, 2008 2 次提交
    • D
      sparc: Fix debugger syscall restart interactions. · 28e61036
      David S. Miller 提交于
      So, forever, we've had this ptrace_signal_deliver implementation
      which tries to handle all of the nasties that can occur when the
      debugger looks at a process about to take a signal.  It's meant
      to address all of these issues inside of the kernel so that the
      debugger need not be mindful of such things.
      
      Problem is, this doesn't work.
      
      The idea was that we should do the syscall restart business first, so
      that the debugger captures that state.  Otherwise, if the debugger for
      example saves the child's state, makes the child execute something
      else, then restores the saved state, we won't handle the syscall
      restart properly because we lose the "we're in a syscall" state.
      
      The code here worked for most cases, but if the debugger actually
      passes the signal through to the child unaltered, it's possible that
      we would do a syscall restart when we shouldn't have.
      
      In particular this breaks the case of debugging a process under a gdb
      which is being debugged by yet another gdb.  gdb uses sigsuspend
      to wait for SIGCHLD of the inferior, but if gdb itself is being
      debugged by a top-level gdb we get a ptrace_stop().  The top-level gdb
      does a PTRACE_CONT with SIGCHLD to let the inferior gdb see the
      signal.  But ptrace_signal_deliver() assumed the debugger would cancel
      out the signal and therefore did a syscall restart, because the return
      error was ERESTARTNOHAND.
      
      Fix this by simply making ptrace_signal_deliver() a nop, and providing
      a way for the debugger to control system call restarting properly:
      
      1) Report a "in syscall" software bit in regs->{tstate,psr}.
         It is set early on in trap entry to a system call and is fully
         visible to the debugger via ptrace() and regsets.
      
      2) Test this bit right before doing a syscall restart.  We have
         to do a final recheck right after get_signal_to_deliver() in
         case the debugger cleared the bit during ptrace_stop().
      
      3) Clear the bit in trap return so we don't accidently try to set
         that bit in the real register.
      
      As a result we also get a ptrace_{is,clear}_syscall() for sparc32 just
      like sparc64 has.
      
      M68K has this same exact bug, and is now the only other user of the
      ptrace_signal_deliver hook.  It needs to be fixed in the same exact
      way as sparc.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28e61036
    • D
      sparc: Fix ptrace() detach. · 986bef85
      David S. Miller 提交于
      Forever we had a PTRACE_SUNOS_DETACH which was unconditionally
      recognized, regardless of the personality of the process.
      
      Unfortunately, this value is what ended up in the GLIBC sys/ptrace.h
      header file on sparc as PTRACE_DETACH and PT_DETACH.
      
      So continue to recognize this old value.  Luckily, it doesn't conflict
      with anything we actually care about.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      986bef85
  2. 10 5月, 2008 1 次提交
  3. 09 5月, 2008 1 次提交
  4. 08 5月, 2008 2 次提交
    • D
      sparc: Fix SA_ONSTACK signal handling. · dc5dc7e6
      David S. Miller 提交于
      We need to be more liberal about the alignment of the buffer given to
      us by sigaltstack().  The user should not need to be mindful of all of
      the alignment constraints we have for the stack frame.
      
      This mirrors how we handle this situation in clone() as well.
      
      Also, we align the stack even in non-SA_ONSTACK cases so that signals
      due to bad stack alignment can be delivered properly.  This makes such
      errors easier to debug and recover from.
      
      Finally, add the sanity check x86 has to make sure we won't overflow
      the signal stack.
      
      This fixes glibc testcases nptl/tst-cancel20.c and
      nptl/tst-cancelx20.c
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dc5dc7e6
    • D
      sparc: Fix fork/clone/vfork system call restart. · 1e38c126
      David S. Miller 提交于
      We clobber %i1 as well as %i0 for these system calls,
      because they give two return values.
      
      Therefore, on error, we have to restore %i1 properly
      or else the restart explodes since it uses the wrong
      arguments.
      
      This fixes glibc's nptl/tst-eintr1.c testcase.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1e38c126
  5. 07 5月, 2008 3 次提交
  6. 06 5月, 2008 2 次提交
  7. 05 5月, 2008 1 次提交
  8. 04 5月, 2008 17 次提交
  9. 03 5月, 2008 11 次提交