Open thaJeztah opened 2 years ago
https://github.com/opencontainers/runc/blob/v1.1.4/libcontainer/utils/utils.go#L123-L129
// Double-check the path is the one we expected.
procfd := "/proc/self/fd/" + strconv.Itoa(int(fh.Fd()))
if realpath, err := os.Readlink(procfd); err != nil {
return fmt.Errorf("procfd verification failed: %w", err)
} else if realpath != path {
return fmt.Errorf("possibly malicious path detected -- refusing to operate on %s", realpath)
}
Looks like os.Readlink("/proc/self/fd/<FD>")
is returning "/var/lib/docker/buildkit/executor/qj8f5s2o4ep3euuoz99hyp7a0/rootfs/etc/resolv.conf (deleted)"
.
A race condition?
Yes, Tõnis expected it was a race condition indeed
@AkihiroSuda Iiuc then something deletes resolv.conf
when runc
is in the middle of open
and readlink
.
Possible suspects are boot running again for same state directory https://github.com/moby/buildkit/blob/master/executor/runcexecutor/executor.go#L108
Something goes wrong in resolv.conf caching (and possibly rename gets called) https://github.com/moby/buildkit/blob/abde08a5531d809a395cf648a31bca932b009af0/executor/oci/resolvconf.go#L29 . This code is quite messy. I wonder if it is worth it at all and we should always create a new file.
As seen on https://github.com/moby/moby/pull/44079#issuecomment-1241021045