I was hunting down an obscure interaction between
ptrace(2) and what happens
when you attach to a process which is in the middle of a
syscall. In fact, if
you read the
ptrace man page there are
a lot of options related to how syscalls are handled, and I tried a variety of
PTRACE_SEIZE followed by
I got stumped on this problem for most of today, and eventually went to go write
a simple test case that didn't involve the Python interpreter so I could get a
better understanding of what was actually happening.
Oddly, my simple test case worked totally fine---I had no issues with
ptrace() while the program was in a syscall state. In fact, by
didn't even cause the syscall to
I eventually figured out what was going on: it's related to some weird magic in the Python interpreter. I would write about it here but I already wrote about the issue in great depth in the GitHub repo. So if you want to read the rest of the story go to eklitzke/ptrace-syscall and check out the README.