Another approach would be giving every process an ID that never repeats and is unique across all namespaces, and use that for comparison instead of the PID.
Another approach would be giving every process an ID that never repeats and is unique across all namespaces, and use that for comparison instead of the PID.
For example, 12.04 LTS release had 12.04.4 with a backported kernel as a standard update.
https://wiki.ubuntu.com/PrecisePangolin/ReleaseNotes/ChangeS...
Doubly difficult from within library code that needs to work in arbitrary programs, and thus cannot mess with signal handling.
I suppose that if the state of your PRNG neatly fits into (almost) a multiple of 4KB, it makes sense to allocate that space explicitly and put a guard bit in there, then mark the entire region as INHERIT_ZERO. This has the added benefit of making it less like that PRNG state is leaked somewhere.
The only advantage I see is that the current solution allows one to implement the random number generator independently of the kernel. Introducing that bit creates a tight coupling.
The futex API (including set_tid_address) is precedence for this kind of syscall.
This seems like a nice choice. PRNG seeds aside, it's always bothered me that processes aren't uniquely identified, which makes monitoring them kind of a pain.
Well, currently. (~585 years to overflow at 1 billion PIDs/sec. Seems absurd, but then again, there are so many cases where we've gone "this should be good enough"...)