Unique randomized wide PIDs
Unique randomized wide PIDs
Posted Jun 14, 2025 9:45 UTC (Sat) by donald.buczek (subscriber, #112892)In reply to: Unique randomized wide PIDs by bluca
Parent article: Slowing the flow of core-dump-related CVEs
I found that you can use fstatfs() on the file descriptor and see if f_type == PID_FS_MAGIC ( 0x50494446; /* "PIDF" */ ). On an elder system it is ANON_INODE_FS_MAGIC (0x09041934)
Note, that although pidfd_open(2) says opening a "/proc/[PID]" directory would be an alternative way to get a PID file descriptor, this is only half true: You can use such a file descriptor with pidfd_* calls, but it is another type of file descriptor with f_type == PROC_SUPER_MAGIC ( 0x9fa0 ) and you can't use the inode number from that kind of file descriptor as a unique process identifier.
I still wish, processes had UUIDs.
