John Baldwin feeaec18d4 Only clear a pending thread event if one is pending.
This fixes a panic when attaching to an already-stopped process after
r325028.  While here, clean up a few other things in the control flow
of the 'sendsig' section:
- Only check for P_STOPPED_TRACE rather than either of P_STOPPED_SIG
  or P_STOPPED_TRACE for most ptrace requests.  The signal handling
  code in kern_sig.c never sets just P_STOPPED_SIG for a traced
  process, so if P_STOPPED_SIG is stopped, P_STOPPED_TRACE should be
  set anyway.  Remove a related debug printf.  Assuming P_STOPPED_TRACE
  permits simplifications in the 'sendsig:' block.
- Move the block to clear the pending thread state up into a new
  block conditional on P_STOPPED_TRACE and handle delivering pending
  signals to the reporting thread and clearing the reporting thread's
  state in this block.
- Consolidate case to send a signal to the process in a single case
  for PT_ATTACH.  The only case that could have been in the else before
  was a PT_ATTACH where P_STOPPED_SIG was not set, so both instances
  of kern_psignal() collapse down to just PT_ATTACH.

Reported by:	pho, mmel
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D12837
2017-11-13 19:58:58 +00:00
..
2017-11-04 15:41:08 +00:00
2017-10-12 15:48:37 +00:00
2017-05-23 09:29:05 +00:00
2016-11-08 23:59:41 +00:00
2017-11-11 18:04:39 +00:00
2017-05-18 18:24:11 +00:00
2017-08-15 02:21:02 +00:00
2017-02-12 09:49:44 +00:00
2017-11-01 06:46:58 +00:00
2017-01-25 20:22:32 +00:00
2017-05-23 16:59:24 +00:00
2017-02-14 13:54:05 +00:00
2017-03-19 00:51:12 +00:00
2017-11-05 19:49:44 +00:00
2017-08-07 14:09:57 +00:00
2016-11-08 23:59:41 +00:00
2017-10-22 13:42:56 +00:00
2017-02-07 16:01:07 +00:00
2017-07-12 07:30:14 +00:00
2017-05-16 23:31:52 +00:00
2017-06-17 00:58:19 +00:00
2017-06-17 00:58:19 +00:00
2017-05-23 09:29:05 +00:00
2017-05-23 09:29:05 +00:00
2017-06-08 21:30:34 +00:00
2017-06-15 04:49:12 +00:00
2017-10-16 21:46:11 +00:00
2017-09-14 18:05:54 +00:00
2017-10-26 19:45:15 +00:00
2017-10-06 09:02:36 +00:00