tech-toolchain archive

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

Re: ptrace code crash (now for real)



On 19.12.2018 08:19, Emmanuel Dreyfus wrote:
> Kamil Rytarowski <n54%gmx.com@localhost> wrote:
> 
>> PT_DETACH resumes execution since address 0x0.
>>
>> You need to specify (void *)1 to resume in the old position.
> 
> Ineed, this is documented in ptrace(2), and doing so it does not crash
> anymore:
>  
>    PT_CONTINUE   
>         The traced process continues execution.  addr is an address
>         specifying the place where execution is to be resumed (a
>         new value for the program counter), or (void *)1 to
>        indicate that execution is to pick up where it left off.
> (...)
>    PT_DETACH     This request is like PT_CONTINUE, (...)
> 
> But this seems NetBSD specific. On Linux:
> 

It's original BSD behavior, Linux does not support the 3rd argument.

> PTRACE_CONT
>     Restart the stopped tracee process. If data is nonzero, it is    
>     interpreted as the number of a signal to be delivered to the tracee;
>     otherwise, no signal is delivered. Thus, for example, the tracer can
>     control whether a signal sent to the tracee is delivered or not. 
>     (addr is ignored.) 
> 
> 


Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index