While working on a syscall emulator similar in structure touser-mode-linux, I found that for many but not all system calls, theptracing parent is notified of the system call exit twice on x86_64 hosts.

This can be trivially demonstrated by running strace on a test programthat makes a non-existant system call such as the attached ptrace_test.c(see output below)

Further testing shows that the bug only occurs when ptracing a 64 bitprocess. 32 bit target processes ptrace fine.