SUMMARY If you call pidfd_send_signal and then run valgrind on your executable you get this message on x86-64: ==822833== For lists of detected and suppressed errors, rerun with: -s ==822833== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) --822834-- WARNING: unhandled amd64-linux syscall: 424 --822834-- You may be able to write your own handler. --822834-- Read the file README_MISSING_SYSCALL_OR_IOCTL. --822834-- Nevertheless we consider this a bug. Please report --822834-- it at http://valgrind.org/support/bug_reports.html.
Note that my libc was not new enough to have a wrapper for this syscall, if yours isn't as well you will want this to reproduce: ``` #include <sys/syscall.h> #ifndef SYS_pidfd_send_signal #define SYS_pidfd_send_signal 424 #endif int pidfd_send_signal(int pidfd, int sig, siginfo_t* info, unsigned int flags) { return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags); } ```
There was a preliminary implementation posted to the mailinglist: https://sourceforge.net/p/valgrind/mailman/message/52515225/
So the only tricky part is that we want to mimic this part of the (generic) PRE(sys_kill): /* If we're sending SIGKILL, check to see if the target is one of our threads and handle it specially. */ if (ARG2 == VKI_SIGKILL && ML_(do_sigkill)(ARG1, -1)) SET_STATUS_Success(0); In the pidfd_send_signal case ARG2 is the signo, just like the kill syscall. But ARG1 is a pidfd and do_sigkill wants an pid (tid). So we have to somehow translate the pidfd to a pid number. It isn't immediately clear how to do that.
Any work on this