summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2020-06-24 16:21:53 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-24 16:23:44 -0700
commit58880bf551f4fdaeecf0a355816f1af353ef81b6 (patch)
tree08a83e1aaef03e042b8618672608ca2bea52de45 /runsc/boot
parent10930b0f8c1ff2ac83c7a30cc1f78112a35e3183 (diff)
Port /dev/net/tun device to VFS2.
Updates #2912 #1035 PiperOrigin-RevId: 318162565
Diffstat (limited to 'runsc/boot')
-rw-r--r--runsc/boot/BUILD1
-rw-r--r--runsc/boot/vfs.go11
2 files changed, 10 insertions, 2 deletions
diff --git a/runsc/boot/BUILD b/runsc/boot/BUILD
index b701c65d2..45d7f7d09 100644
--- a/runsc/boot/BUILD
+++ b/runsc/boot/BUILD
@@ -41,6 +41,7 @@ go_library(
"//pkg/sentry/control",
"//pkg/sentry/devices/memdev",
"//pkg/sentry/devices/ttydev",
+ "//pkg/sentry/devices/tundev",
"//pkg/sentry/fdimport",
"//pkg/sentry/fs",
"//pkg/sentry/fs/dev",
diff --git a/runsc/boot/vfs.go b/runsc/boot/vfs.go
index 2fdddc719..9ba5e9cd9 100644
--- a/runsc/boot/vfs.go
+++ b/runsc/boot/vfs.go
@@ -27,6 +27,7 @@ import (
"gvisor.dev/gvisor/pkg/log"
"gvisor.dev/gvisor/pkg/sentry/devices/memdev"
"gvisor.dev/gvisor/pkg/sentry/devices/ttydev"
+ "gvisor.dev/gvisor/pkg/sentry/devices/tundev"
"gvisor.dev/gvisor/pkg/sentry/fs/user"
"gvisor.dev/gvisor/pkg/sentry/fsimpl/devpts"
"gvisor.dev/gvisor/pkg/sentry/fsimpl/devtmpfs"
@@ -79,6 +80,9 @@ func registerFilesystems(ctx context.Context, vfsObj *vfs.VirtualFilesystem, cre
if err := ttydev.Register(vfsObj); err != nil {
return fmt.Errorf("registering ttydev: %w", err)
}
+ if err := tundev.Register(vfsObj); err != nil {
+ return fmt.Errorf("registering tundev: %v", err)
+ }
a, err := devtmpfs.NewAccessor(ctx, vfsObj, creds, devtmpfs.Name)
if err != nil {
return fmt.Errorf("creating devtmpfs accessor: %w", err)
@@ -89,10 +93,13 @@ func registerFilesystems(ctx context.Context, vfsObj *vfs.VirtualFilesystem, cre
return fmt.Errorf("initializing userspace: %w", err)
}
if err := memdev.CreateDevtmpfsFiles(ctx, a); err != nil {
- return fmt.Errorf("creating devtmpfs files: %w", err)
+ return fmt.Errorf("creating memdev devtmpfs files: %w", err)
}
if err := ttydev.CreateDevtmpfsFiles(ctx, a); err != nil {
- return fmt.Errorf("creating devtmpfs files: %w", err)
+ return fmt.Errorf("creating ttydev devtmpfs files: %w", err)
+ }
+ if err := tundev.CreateDevtmpfsFiles(ctx, a); err != nil {
+ return fmt.Errorf("creating tundev devtmpfs files: %v", err)
}
return nil
}