You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Though the mount destination path /proc/net/dev is in the mount whitelist, but we still can't mount it in the container.
root@acmcoder:/opt/ubuntu# docker run --rm -v /mynetdev:/proc/net/dev busybox cat /proc/net/dev
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/mynetdev" to rootfs at "/proc/net/dev": create mountpoint for /proc/net/dev mount: check proc-safety of /proc/net/dev mount: "/var/lib/docker/overlay2/4003a74c35de34187abfc1fdcb8509d321d8f9319cce28957a5ee5569e40ad8d/merged/proc/1/net/dev" cannot be mounted because it is inside /proc: unknown.
@lifubang why do you want to mount on top of that? Do you want to hide some stats? Or fake them? Is namespaces what is exposed there or the whole host?
I think /proc/net/dev being added to the allow-list is a mistake and we should just remove it:
It is not a global property, /proc/net is a symlink to /proc/self/net (which means /proc/1/net when runc is setting up mounts). Mounting over non-global properties like this makes very little sense in general -- most programs will look at their own configurations (which is also at /proc/net/... for them) which will not contain the overmounts and thus the mount will be useless, and non-privileged programs will probably not even have access to /proc/1/... information.
The justification that this is "for lxcfs" is wrong, because lxcfs has never mounted such files (mounting over per-process files does not scale well and requires a lot of extra management infrastructure that lxc does not use, nor want). lxcfs only has overmounts for /proc/cpuinfo, /proc/meminfo and a few other global/proc files.
The kernel is slowly moving towards denying these kinds of mounts entirely -- upon my insistence, Linux 6.12 blocked mounts on top of /proc/self/fd, /proc/self/fdinfo, and /proc/self/map_files and future versions of Linux will probably end up blocking everything in /proc/$pid/*.
I don't see why you would even want to mount on top of /proc/net/dev -- /proc/self/net is already namespaced with network namespaces, and the contents of /proc/self/net are already correct for the container! Why would you ever need to fake the contents of that file?!
EDIT: The error is coming from the fact that /proc/net is a symlink to self/net, which gets expanded before we check in checkProcMount. I suspect this overmount has never worked, and should never have been added. I'll send a patch to remove it.
@lifubang why do you want to mount on top of that? Do you want to hide some stats? Or fake them? Is namespaces what is exposed there or the whole host?
I’ve never used this feature myself — I only came across it during a code review.
Looking at the commit provided by @cyphar, I found the original comment:
// These entries can be bind mounted by files emulated by fuse,
// so commands like top, free displays stats in container.
However, I believe this mount point has likely been unusable for years, and there may not be any real-world usage of it anymore.
Activity
rata commentedon Jul 14, 2025
@lifubang why do you want to mount on top of that? Do you want to hide some stats? Or fake them? Is namespaces what is exposed there or the whole host?
cyphar commentedon Jul 20, 2025
I think
/proc/net/devbeing added to the allow-list is a mistake and we should just remove it:/proc/netis a symlink to/proc/self/net(which means/proc/1/netwhen runc is setting up mounts). Mounting over non-global properties like this makes very little sense in general -- most programs will look at their own configurations (which is also at/proc/net/...for them) which will not contain the overmounts and thus the mount will be useless, and non-privileged programs will probably not even have access to/proc/1/...information.lxcfs" is wrong, becauselxcfshas never mounted such files (mounting over per-process files does not scale well and requires a lot of extra management infrastructure thatlxcdoes not use, nor want).lxcfsonly has overmounts for/proc/cpuinfo,/proc/meminfoand a few other global/procfiles./proc/self/fd,/proc/self/fdinfo, and/proc/self/map_filesand future versions of Linux will probably end up blocking everything in/proc/$pid/*./proc/net/dev--/proc/self/netis already namespaced with network namespaces, and the contents of/proc/self/netare already correct for the container! Why would you ever need to fake the contents of that file?!EDIT: The error is coming from the fact that
/proc/netis a symlink toself/net, which gets expanded before we check incheckProcMount. I suspect this overmount has never worked, and should never have been added. I'll send a patch to remove it.cyphar commentedon Jul 20, 2025
FWIW, this was added in 2ee9cbb (#560) and there is no explanation for why
/proc/net/devis special.lifubang commentedon Jul 21, 2025
I’ve never used this feature myself — I only came across it during a code review.
Looking at the commit provided by @cyphar, I found the original comment:
However, I believe this mount point has likely been unusable for years, and there may not be any real-world usage of it anymore.