Syscall recvmsg() can be used to create file descriptors in client process
As described in man 7 unix
, the system call recvmsg()
can be used to "pass" file descriptors between processes through an AF_UNIX
socket by specifying SCM_RIGHTS
and encoding an array of the desired file descriptors in the msghdr
argument. This operation is referred to as "passing a file descriptor" to another process. However, more accurately, what is being passed is a reference to an open file description (see open(2)), and in the receiving process it is likely that a different file descriptor number will be used. Semantically, this operation is equivalent to duplicating (dup(2)) a file descriptor into the file descriptor table of another process.
Since this can technically add file descriptors to the client process during initialization, we should handle this case for internal system calls and register any such file descriptors as "internal file descriptors".