I have a series ready that allows generating and opening autonomous #pidfd file handles.

Regular file handles require the caller to specify a file descriptor identifying the filesystem with open_by_handle_at().

For in-kernel filesystems that are a singleton (single superblock for the lifetime of the system) that's just not at all necessary.

Capable filesystems can opt-in to generating autonomous/self-sufficient/self-descriptive file handles.

https://web.git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=work.pidfs.fhandle

That's pretty neat because you can open up a #pidfd solely based on the inode number (they're unique and race-free).

Making sure you're not a bot!

And btw, #pidfd file handles can be generated and opened unprivileged. The only restriction that's enforced is that the task the #pidfd refers to must be resolvable in the caller's pid namespace.

This scheme would also work for @sima 's #dmabuf file handles (should that become an actual thing) or other in-kernel filesystems.

For example, namespace file descriptors could work the same way although they would need to be uniqified and a lookup routine for them implemented similar to what I did with #pidfs.