NetBSD-Bugs archive

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

Re: kern/53800: ptrace crashes

On Dec 19,  5:40am, ( wrote:
-- Subject: Re: kern/53800: ptrace crashes

| The following reply was made to PR kern/53800; it has been noted by GNATS.
| From:
| To:
| Cc: 
| Subject: Re: kern/53800: ptrace crashes
| Date: Wed, 19 Dec 2018 05:38:50 +0000
|  Looks like the problem is commented:
|          case PT_ATTACH:
|                  /*
|                   * Go ahead and set the trace flag.
|                   * Save the old parent (it's reset in
|                   *   _DETACH, and also in kern_exit.c:wait4()
|                   * Reparent the process so that the tracing
|                   *   proc gets to see all the action.
|  But it is not reset in _DETACH.

Nope, it is reset in PT_DETACH. In fact the code works as documented...
It crashes because the code jumps to 0. Since PT_DETACH works like
PT_CONTINUE, passing NULL as the 3rd argument to ptrace will do that :-)
Try passing (void *)1 and it will work. Arguably this is not a very
useful or expected feature, but I don't think that changing it is


Home | Main Index | Thread Index | Old Index