Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Apr 2010 19:06:17 +0000
From:      Gunnar Hinriksson <tomtinn@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Ptrace segfault
Message-ID:  <q2vcbb19c781004291206sc54fdb6ag53c3a763ad364e8e@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello

Im having a little problem using ptrace on my system.
If I use ptrace to attach to another process the child process
segfaults once I detach.
For example using this simple program.

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/wait.h>

int main(int argc, char *argv[])
{
        int pid = atoi(argv[1]);
        ptrace(PT_ATTACH, pid, 0, 0);
        wait(NULL);
        ptrace(PT_DETACH, pid, 0, 0);
        return 0;
}

Am I using ptrace incorrectly or is there perhaps a bug in ptrace that
causes the child to always segfault ?

With Regards

Gunnar

FreeBSD knut 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Apr 27
04:36:16 UTC 2010     gunnar@knut:/usr/obj/usr/src/sys/GENERIC  amd64



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?q2vcbb19c781004291206sc54fdb6ag53c3a763ad364e8e>