Skip to content



pidfd_open - open a PID file descriptor for the given process


The pidfd_open syscall allows users to obtain a file descriptor referring to the PID of the specified process. This syscall is useful in situations where one process needs access to the PID of another process in order to send signals, retrieve information about the process, or similar operations. It can also be used to monitor the lifetime of the process, since the file descriptor is closed when the process terminates.

One of the use cases for pidfd_open is in containers that wish to move the management of their associated process to the kernel level. By using pidfd_open and then passing the resulting file descriptor to the kernel through pidfd_getfd, the application can ensure that it has proper control over the process and ensure that operations like signals and process management take effect atomically.

There are some drawbacks to using pidfd_open. Since the file descriptor is closed when the process terminates, this can lead to race conditions if the process dies quickly. Additionally, pidfd_open can only be used with processes that the caller has permission to access, and if the caller does not have the necessary permissions, a permission denied error will be returned.


  • pid:pid_t - the process ID of the target process.
  • flags:unsigned int - a bitmask of flags that modify the functionality of the system call.

Available Tags

  • U - Originated from user space (for example, pointer to user space memory used to get it)
  • TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
  • OPT - Optional argument - might not always be available (passed with null value)






To monitor the opening of PID file descriptors and track the information associated with them.

Example Use Case

This syscall could be used in a multi-process application that needs to track the lifetimes of several processes or send signals to them. By obtaining a file descriptor for each process, the application can monitor their lifetimes and send signals in a safe and atomic manner.

In addition, this syscall can also be used in a container context. By opening a PID file descriptor and passing it to the kernel through the pidfd_getfd syscall, the container can ensure that process management and signal delivery are handled in an atomic manner.


This syscall is vulnerable to a time-of-check/time-of-use race condition. If the target process terminates quickly, it is possible that the file descriptor will be closed before the calling process can act on it.

Additionally, since the caller must have permission to access the target process, this syscall may fail if the proper permissions are not set.

  • pidfd_getfd - gets the file descriptor of a process using a PID file descriptor
  • pidfd_send_signal - sends a signal to a process using a PID file descriptor

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.