diff options
author | Ian Lewis <ianlewis@google.com> | 2020-06-11 19:29:34 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-11 19:31:24 -0700 |
commit | 8ea99d58ffd708aa7a26be58d89cb817d8eceec6 (patch) | |
tree | d5ff8477c5f13082364398cc20e73781322921a0 /runsc/boot/loader.go | |
parent | 5a894e35a090232085fbb20c71d1787c266bd995 (diff) |
Set the HOME environment variable for sub-containers.
Fixes #701
PiperOrigin-RevId: 316025635
Diffstat (limited to 'runsc/boot/loader.go')
-rw-r--r-- | runsc/boot/loader.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/runsc/boot/loader.go b/runsc/boot/loader.go index 002479612..b05a8bd45 100644 --- a/runsc/boot/loader.go +++ b/runsc/boot/loader.go @@ -754,6 +754,21 @@ func (l *Loader) startContainer(spec *specs.Spec, conf *Config, cid string, file return err } + // Add the HOME enviroment variable if it is not already set. + var envv []string + if kernel.VFS2Enabled { + envv, err = user.MaybeAddExecUserHomeVFS2(ctx, procArgs.MountNamespaceVFS2, + procArgs.Credentials.RealKUID, procArgs.Envv) + + } else { + envv, err = user.MaybeAddExecUserHome(ctx, procArgs.MountNamespace, + procArgs.Credentials.RealKUID, procArgs.Envv) + } + if err != nil { + return err + } + procArgs.Envv = envv + // Create and start the new process. tg, _, err := l.k.CreateProcess(procArgs) if err != nil { |