6 Commits
Author SHA1 Message Date
Jamie LiuandgVisor bot f4b851067a Un-delete devtmpfs.
This partially reverts cl/578969556, but implements devtmpfs using fsimpl/dev
(added by that CL).

Note that the behavior of "devtmpfs" differs compared to before cl/578969556.
Container runtime specs typically specify a tmpfs mount at /dev, which the
container runtime is required to prepopulate with certain device files
(https://github.com/opencontainers/runtime-spec/blob/main/config-linux.md#default-devices).
Prior to cl/578969556, runsc did so by silently replacing tmpfs mounts at /dev
with devtmpfs mounts. After that CL, runsc does so by silently replacing tmpfs
mounts at /dev with fsimpl/dev mounts. The distinction is that devtmpfs is a
singleton whereas fsimpl/dev is not, so in a multi-container sandbox, all
containers shared the contents of /dev before cl/578969556, but not after that
CL; this change was necessary due to differences in GPU/TPU accessibility
between containers, and is also more consistent with runc (which also creates
separate tmpfs mounts for /dev as specified).

As a side effect, explicit devtmpfs mounts shared the same filesystem as every
container's /dev before cl/578969556. Since the change to container /dev won't
be reverted, our options now are:

- All devtmpfs mounts share a single filesystem, which is distinct from any
  container's /dev.

- Each devtmpfs mount gets a distinct filesystem.

This CL chooses the former option for greater similarity to Linux devtmpfs
semantics. (In runc, explicit devtmpfs mounts share a single filesystem, which
is the *host's* /dev.)

PiperOrigin-RevId: 589021563
2023-12-07 23:10:44 -08:00
Ayush RanjanandgVisor bot 9e66f710de Delete devtmpfs and replace it with tmpfs.
Our devtmpfs implementation uses the same tmpfs filesystem instance for all
devtmpfs mounts in the sandbox. This would mean that devices mounted in a
container are visible and accessible to all other containers in the sandbox.

With GPU/TPU, the contents of devtmpfs can be different for different
containers within the same sandbox. So it is important to not share the same
devtmpfs contents.

It is better to drop support for devtmpfs, than to implement it incorrectly.
Instead, this change introduces a new dummy filesystem type named `dev`. This
filesystem can not be mounted or listed by the application. This filesystem
creates a new tmpfs instance on GetFilesystem() and populates it with all the
device files.

PiperOrigin-RevId: 578969556
2023-11-02 13:58:58 -07:00
Adin ScannellandgVisor bot 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Jamie LiuandgVisor bot 9f87400f08 Support VFS2 save/restore.
Inode number consistency checks are now skipped in save/restore tests for
reasons described in greatest detail in StatTest.StateDoesntChangeAfterRename.
They pass in VFS1 due to the bug described in new test case
SimpleStatTest.DifferentFilesHaveDifferentDeviceInodeNumberPairs.

Fixes #1663

PiperOrigin-RevId: 338776148
2020-10-23 17:48:33 -07:00
Nicolas LacasseandgVisor bot 2c422b7f21 Fix parent directory creation in CreateDeviceFile.
It was not properly creating recursive directories. Added tests for this case.

Updates #1196

PiperOrigin-RevId: 327850811
2020-08-21 12:10:14 -07:00
Jamie LiuandgVisor bot 2862b0b1be Add //pkg/sentry/fsimpl/devtmpfs.
PiperOrigin-RevId: 292021389
2020-01-28 15:05:24 -08:00