|
|
Log in / Subscribe / Register

Unique randomized wide PIDs

Unique randomized wide PIDs

Posted Jun 8, 2025 10:03 UTC (Sun) by dezgeg (guest, #92243)
In reply to: Unique randomized wide PIDs by jreiser
Parent article: Slowing the flow of core-dump-related CVEs

Would that really help with anything though, given the sequence is still entirely predictable?


to post comments

Unique randomized wide PIDs

Posted Jun 8, 2025 18:11 UTC (Sun) by bmenrigh (subscriber, #63018) [Link] (4 responses)

Yeah an LFSR wouldn’t be secure. However a customer block cipher (where the block size matches the PID size) eliminates the predictability issue. Just generate a random key at startup.

Unique randomized wide PIDs

Posted Jun 9, 2025 12:00 UTC (Mon) by bluca (subscriber, #118303) [Link] (3 responses)

Although it is mildly amusing watching the rediscovery of UUIDs in this thread (hint: it's what Windows uses), it is unnecessary: with the new kernel the pidfd inode number is guaranteed unique per boot, so we have a solution for this now (there's also the boot uuid, so the combination of boot uuid + pidfd inode id gives a universal unique identifier, if that is needed). PIDs can never be changed, as all existing software will break. No, it's not just a matter of "recompiling", existing binaries need to work too with new kernels, so that's not an option. But we are starting to expose pidfd inodes in more places now, so I guess they'll slowly take over for new functionality.

Unique randomized wide PIDs

Posted Jun 12, 2025 8:48 UTC (Thu) by donald.buczek (subscriber, #112892) [Link] (2 responses)

However, I wonder how userspace can easily determine whether a pidfd inode number comes from a system that guarantees uniqueness.

Unique randomized wide PIDs

Posted Jun 12, 2025 11:15 UTC (Thu) by bluca (subscriber, #118303) [Link] (1 responses)

There was a way, I forget the details, but on systems where it's not unique it's a fixed/hardcoded/well-known inode number, because it's an anonymous inode rather than from pidfdfs? Details are fuzzy so I might be getting this wrong

Unique randomized wide PIDs

Posted Jun 14, 2025 9:45 UTC (Sat) by donald.buczek (subscriber, #112892) [Link]

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.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds