ptrace - Minix

This is a discussion on ptrace - Minix ; All, I was wondering if there is someone out there with some experience using the ptrace system call (preferably under Minix, but another OS might do as well). Is it possible to stop a process from being traced? So a ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: ptrace

  1. ptrace

    All,

    I was wondering if there is someone out there with some experience using the
    ptrace system call (preferably under Minix, but another OS might do as
    well). Is it possible to stop a process from being traced? So a child
    process can call ptrace to enable tracing by its parent, but is there a way
    for the parent to say: I'm done tracing, just live on happily ever after?

    Technically this should be just a matter of clearing the traced bit in in
    the process table, but there seems to be no official way of doing this. BTW,
    the Minix man page isn't very helpful on this, since it's a mere copy from
    another operating system, totally unrelated to the Minix implementation...

    Peter Boonstoppel



  2. Re: ptrace

    Peter Boonstoppel wrote:
    > I was wondering if there is someone out there with some experience using the
    > ptrace system call (preferably under Minix, but another OS might do as
    > well). Is it possible to stop a process from being traced? So a child
    > process can call ptrace to enable tracing by its parent, but is there a way
    > for the parent to say: I'm done tracing, just live on happily ever after?


    On Linux: PTRACE_DETACH.

    ptrace(PTRACE_DETACH, child_pid, NULL, NULL);

    From the man page:

    PTRACE_DETACH
    Restarts the stopped child as for PTRACE_CONT, but
    first detaches from the process, undoing the repar-
    enting effect of PTRACE_ATTACH, and the effects of
    PTRACE_TRACEME. Although perhaps not intended,
    under Linux a traced child can be detached in this
    way regardless of which method was used to initiate
    tracing.

    This should send the child process on its merry way. Sorry, I have no
    idea if it works on Minix. I hope this is helpful.

    Cheers,

    Jon

  3. Re: ptrace

    > On Linux: PTRACE_DETACH.
    >
    > ptrace(PTRACE_DETACH, child_pid, NULL, NULL);


    I checked and Minix only supports these commands given to ptrace, so I guess
    it's just impossible...

    * T_STOP stop the process
    * T_OK enable tracing by parent for this process
    * T_GETINS return value from instruction space
    * T_GETDATA return value from data space
    * T_GETUSER return value from user process table
    * T_SETINS set value from instruction space
    * T_SETDATA set value from data space
    * T_SETUSER set value in user process table
    * T_RESUME resume execution
    * T_EXIT exit
    * T_STEP set trace bit

    Peter



  4. Re: ptrace

    Peter Boonstoppel wrote:
    > All,
    >
    > I was wondering if there is someone out there with some experience using the
    > ptrace system call (preferably under Minix, but another OS might do as
    > well). Is it possible to stop a process from being traced? So a child
    > process can call ptrace to enable tracing by its parent, but is there a way
    > for the parent to say: I'm done tracing, just live on happily ever after?
    >
    > Technically this should be just a matter of clearing the traced bit in in
    > the process table, but there seems to be no official way of doing this. BTW,
    > the Minix man page isn't very helpful on this, since it's a mere copy from
    > another operating system, totally unrelated to the Minix implementation...
    >
    > Peter Boonstoppel
    >
    >


    Why, WHY did someone copy the pthrace manpage from 4BSD?

+ Reply to Thread