summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/loader.go
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2018-09-17 11:30:16 -0700
committerShentubot <shentubot@google.com>2018-09-17 11:31:28 -0700
commit25add7b22b1b0b6a4bac1e72536d3f3a0c70f048 (patch)
tree87b4ecb9dcf96d2de23cb54328d04650e60b502e /runsc/boot/loader.go
parentde5a590ee203b4ee217da68dbec8e58a7753e520 (diff)
runsc: Fix stdin/out/err in multi-container mode.
Stdin/out/err weren't being sent to the sentry. PiperOrigin-RevId: 213307171 Change-Id: Ie4b634a58b1b69aa934ce8597e5cc7a47a2bcda2
Diffstat (limited to 'runsc/boot/loader.go')
-rw-r--r--runsc/boot/loader.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go
index 2ddb358bd..5e9ccb96f 100644
--- a/runsc/boot/loader.go
+++ b/runsc/boot/loader.go
@@ -77,8 +77,11 @@ type Loader struct {
watchdog *watchdog.Watchdog
- // ioFDs are the FDs that attach the sandbox to the gofers.
- ioFDs []int
+ // stdioFDs contains stdin, stdout, and stderr.
+ stdioFDs []int
+
+ // goferFDs are the FDs that attach the sandbox to the gofers.
+ goferFDs []int
// spec is the base configuration for the root container.
spec *specs.Spec
@@ -121,7 +124,7 @@ func init() {
// New initializes a new kernel loader configured by spec.
// New also handles setting up a kernel for restoring a container.
-func New(spec *specs.Spec, conf *Config, controllerFD, deviceFD int, ioFDs []int, console bool) (*Loader, error) {
+func New(spec *specs.Spec, conf *Config, controllerFD, deviceFD int, goferFDs []int, console bool) (*Loader, error) {
// Create kernel and platform.
p, err := createPlatform(conf, deviceFD)
if err != nil {
@@ -252,7 +255,8 @@ func New(spec *specs.Spec, conf *Config, controllerFD, deviceFD int, ioFDs []int
conf: conf,
console: console,
watchdog: watchdog,
- ioFDs: ioFDs,
+ stdioFDs: []int{syscall.Stdin, syscall.Stdout, syscall.Stderr},
+ goferFDs: goferFDs,
spec: spec,
startSignalForwarding: startSignalForwarding,
rootProcArgs: procArgs,
@@ -364,7 +368,8 @@ func (l *Loader) run() error {
&l.rootProcArgs,
l.spec,
l.conf,
- l.ioFDs,
+ l.stdioFDs,
+ l.goferFDs,
l.console,
l.rootProcArgs.Credentials,
l.rootProcArgs.Limits,
@@ -446,7 +451,8 @@ func (l *Loader) startContainer(k *kernel.Kernel, spec *specs.Spec, conf *Config
&procArgs,
spec,
conf,
- ioFDs,
+ ioFDs[:3], // stdioFDs
+ ioFDs[3:], // goferFDs
false,
creds,
procArgs.Limits,