On my first post with the same $topic, I’ve described a ptrace bug on FreeBSD. I’ve reported this issue on freebsd-hackers mailing list and submitted a PR and FreeBSD developers have fixed the problem.

Here’s how they did it: - r202882
- r203608

A big thanks!