summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-09-02 14:45:26 +0000
committergVisor bot <gvisor-bot@google.com>2020-09-02 14:45:26 +0000
commit13513ded54c4efeb7bdc7887ba4ed9cc753440e8 (patch)
tree878cc2dc0821d789aa67908b48703b5852019418 /runsc
parent0c18ed111c22f59bca103a69bceb632cd0348a54 (diff)
parenta0e431038477282b95658f104266a7c60ed427db (diff)
Merge release-20200818.0-108-ga0e431038 (automated)
Diffstat (limited to 'runsc')
-rw-r--r--runsc/boot/loader.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go
index c3c754046..882cf270b 100644
--- a/runsc/boot/loader.go
+++ b/runsc/boot/loader.go
@@ -689,9 +689,18 @@ func (l *Loader) startContainer(spec *specs.Spec, conf *config.Config, cid strin
return fmt.Errorf("creating new process: %v", err)
}
- // setupContainerFS() dups stdioFDs, so we don't need to dup them here.
+ // VFS1 dups stdioFDs, so we don't need to dup them here. VFS2 takes
+ // ownership of the passed FDs, and we need to dup them here.
for _, f := range files[:3] {
- info.stdioFDs = append(info.stdioFDs, int(f.Fd()))
+ if !kernel.VFS2Enabled {
+ info.stdioFDs = append(info.stdioFDs, int(f.Fd()))
+ } else {
+ fd, err := unix.Dup(int(f.Fd()))
+ if err != nil {
+ return fmt.Errorf("failed to dup file: %v", err)
+ }
+ info.stdioFDs = append(info.stdioFDs, fd)
+ }
}
// Can't take ownership away from os.File. dup them to get a new FDs.