mirror of
https://github.com/opencontainers/runc.git
synced 2026-11-06 05:17:05 +00:00
File descriptors created via the os package are close-on-exec by default, but the raw syscall wrappers do exactly what they are told, and a few call sites forgot to ask for it: * registerMemoryEventV2 creates an inotify descriptor which is kept open for the whole lifetime of the container by the OOM notifier goroutine, so it would leak into every "runc exec" process. * pivotRoot opens the old root, which is only needed until the pivot_root(2) dance is over. * readArgString in the seccomp agent opens /proc/PID/mem. None of these descriptors are meant to be inherited, so set O_CLOEXEC (IN_CLOEXEC for inotify). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>