Grabbing file descriptors with pidfd_getfd()
Grabbing file descriptors with pidfd_getfd()
Posted Jan 29, 2020 1:35 UTC (Wed) by cyphar (subscriber, #110703)In reply to: Grabbing file descriptors with pidfd_getfd() by dona73110
Parent article: Grabbing file descriptors with pidfd_getfd()
You're right about how magic-links work (and re-opening through /proc/$pid/fd does work for pipes), but this does not work for sockets or anonfds -- you'll get -ENXIO when you try to re-open them. Additionally, there is still a pid recycling race condition if you use procfs (unless you have a first-generation /proc/$pid-style pidfd).
