Fix FIFO, sockets and device files when run in user NS
commit 617c352e9225 "Don't create devices if in a user namespace" introduced check, which meant to skip mknod operation when run in user namespace, but instread skipped FIFO and socket files copy. Signed-off-by: Maxim Ivanov <ivanov.maxim@gmail.com> Upstream-commit: 6f084f292932c464a30b56edb9edbe238bdcf0aa Component: engine
This commit is contained in:
@@ -189,15 +189,15 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
|
||||
case os.ModeNamedPipe:
|
||||
fallthrough
|
||||
case os.ModeSocket:
|
||||
if rsystem.RunningInUserNS() {
|
||||
// cannot create a device if running in user namespace
|
||||
return nil
|
||||
}
|
||||
if err := unix.Mkfifo(dstPath, stat.Mode); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case os.ModeDevice:
|
||||
if rsystem.RunningInUserNS() {
|
||||
// cannot create a device if running in user namespace
|
||||
return nil
|
||||
}
|
||||
if err := unix.Mknod(dstPath, stat.Mode, int(stat.Rdev)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user