diff options
author | Rahat Mahmood <rahat@google.com> | 2018-12-12 17:47:01 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-12 17:47:55 -0800 |
commit | ccce1d4281ce82fe551d7c8569fe3a545c62e296 (patch) | |
tree | cbcfbd64ba151097c5734102f6d1e1dfecdcd160 /pkg/sentry/fs/dev | |
parent | f93c288dd70846f335239e2d0cb351135a756f51 (diff) |
Filesystems shouldn't be saving references to Platform.
Platform objects are not savable, storing references to them in
filesystem datastructures would cause save to fail if someone actually
passed in a Platform.
Current implementations work because everywhere a Platform is
expected, we currently pass in a Kernel object which embeds Platform
and thus satisfies the interface.
Eliminate this indirection and save pointers to Kernel directly.
PiperOrigin-RevId: 225288336
Change-Id: Ica399ff43f425e15bc150a0d7102196c3d54a2ab
Diffstat (limited to 'pkg/sentry/fs/dev')
-rw-r--r-- | pkg/sentry/fs/dev/BUILD | 1 | ||||
-rw-r--r-- | pkg/sentry/fs/dev/dev.go | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/pkg/sentry/fs/dev/BUILD b/pkg/sentry/fs/dev/BUILD index fc069bb5f..b17b5202c 100644 --- a/pkg/sentry/fs/dev/BUILD +++ b/pkg/sentry/fs/dev/BUILD @@ -25,6 +25,7 @@ go_library( "//pkg/sentry/fs/fsutil", "//pkg/sentry/fs/ramfs", "//pkg/sentry/fs/tmpfs", + "//pkg/sentry/kernel", "//pkg/sentry/memmap", "//pkg/sentry/mm", "//pkg/sentry/platform", diff --git a/pkg/sentry/fs/dev/dev.go b/pkg/sentry/fs/dev/dev.go index 05a5005ad..3e127bf04 100644 --- a/pkg/sentry/fs/dev/dev.go +++ b/pkg/sentry/fs/dev/dev.go @@ -22,7 +22,7 @@ import ( "gvisor.googlesource.com/gvisor/pkg/sentry/fs/binder" "gvisor.googlesource.com/gvisor/pkg/sentry/fs/ramfs" "gvisor.googlesource.com/gvisor/pkg/sentry/fs/tmpfs" - "gvisor.googlesource.com/gvisor/pkg/sentry/platform" + "gvisor.googlesource.com/gvisor/pkg/sentry/kernel" "gvisor.googlesource.com/gvisor/pkg/sentry/usermem" ) @@ -86,7 +86,7 @@ func New(ctx context.Context, msrc *fs.MountSource, binderEnabled bool, ashmemEn "random": newCharacterDevice(newRandomDevice(ctx, fs.RootOwner, 0444), msrc), "urandom": newCharacterDevice(newRandomDevice(ctx, fs.RootOwner, 0444), msrc), - "shm": tmpfs.NewDir(ctx, nil, fs.RootOwner, fs.FilePermsFromMode(0777), msrc, platform.FromContext(ctx)), + "shm": tmpfs.NewDir(ctx, nil, fs.RootOwner, fs.FilePermsFromMode(0777), msrc, kernel.KernelFromContext(ctx)), // A devpts is typically mounted at /dev/pts to provide // pseudoterminal support. Place an empty directory there for |