summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/devtmpfs
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-24 00:37:57 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-24 00:37:57 +0000
commit01665b4a54afd0efe5b376a789865de66b57ef87 (patch)
tree31e9b0befef005444f47a52a34aae12fe32712d1 /pkg/sentry/fsimpl/devtmpfs
parentc860716ef867306f28feccf25ab9c0066e3c5ffb (diff)
parent696feaf10c9339a57d177a913e847ddb488ece69 (diff)
Merge release-20200323.0-228-g696feaf (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/devtmpfs')
-rwxr-xr-xpkg/sentry/fsimpl/devtmpfs/devtmpfs.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/pkg/sentry/fsimpl/devtmpfs/devtmpfs.go b/pkg/sentry/fsimpl/devtmpfs/devtmpfs.go
index 64f1b142c..142ee53b0 100755
--- a/pkg/sentry/fsimpl/devtmpfs/devtmpfs.go
+++ b/pkg/sentry/fsimpl/devtmpfs/devtmpfs.go
@@ -163,16 +163,25 @@ func (a *Accessor) CreateDeviceFile(ctx context.Context, pathname string, kind v
func (a *Accessor) UserspaceInit(ctx context.Context) error {
actx := a.wrapContext(ctx)
- // systemd: src/shared/dev-setup.c:dev_setup()
+ // Initialize symlinks.
for _, symlink := range []struct {
source string
target string
}{
- // /proc/kcore is not implemented.
+ // systemd: src/shared/dev-setup.c:dev_setup()
{source: "fd", target: "/proc/self/fd"},
{source: "stdin", target: "/proc/self/fd/0"},
{source: "stdout", target: "/proc/self/fd/1"},
{source: "stderr", target: "/proc/self/fd/2"},
+ // /proc/kcore is not implemented.
+
+ // Linux implements /dev/ptmx as a device node, but advises
+ // container implementations to create /dev/ptmx as a symlink
+ // to pts/ptmx (Documentation/filesystems/devpts.txt). Systemd
+ // follows this advice (src/nspawn/nspawn.c:setup_pts()), while
+ // LXC tries to create a bind mount and falls back to a symlink
+ // (src/lxc/conf.c:lxc_setup_devpts()).
+ {source: "ptmx", target: "pts/ptmx"},
} {
if err := a.vfsObj.SymlinkAt(actx, a.creds, a.pathOperationAt(symlink.source), symlink.target); err != nil {
return fmt.Errorf("failed to create symlink %q => %q: %v", symlink.source, symlink.target, err)