NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/53800: ptrace crashes
>Number:         53800
>Category:       kern
>Synopsis:       ptrace crashes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 19 03:50:00 +0000 2018
>Originator:     coypu
>Release:        NetBSD 8.99.27
>Organization:
>Environment:
NetBSD planets 8.99.27 NetBSD 8.99.27 (GENERIC) #5: Tue Dec 11 20:55:49 IST 2018  fly@planets:/home/fly/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
>How-To-Repeat:
The following code crashes.
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, const char *argv[])
{	   
	int pid, ppid;
	pid = fork();
	if (pid == 0) {
		ppid = getppid();
		if (ptrace(PT_ATTACH, ppid, NULL, 0) == 0) {
			waitpid(ppid, NULL, 0);
			ptrace(PT_DETACH, ppid, NULL, 0);
		}
	}	
	
	sleep(1);
	return 0;
}
>Fix:
Home |
Main Index |
Thread Index |
Old Index