@anselmschueler @myrrhperiwinkle @whitequark > You need to rely on something other than the kernel for this basic property of your process.
Then I have good news for you: procfs is a pseudo-filesystem implemented in your kernel.
> Unless you make your own mount, which I'm not sure whether you can in some way without effective root.
Namespaces, but in case of procfs requiring root is a good idea(see mount options, that give more isolation).
> Even if you make your own mount, it's a hideously complicated sequence compared to just having a syscall for this, especially if you rigorously use O_PATH etc. to avoid TOCTOU. The path is effectively a magic number (a magic string) which is just inelegant.
System call numbers are also magic numbers in that sense. If syscall numbers could be rebound, we would be in exactly same situation regardless of mapping in VFS.