26 Commits
Author SHA1 Message Date
Andrei VaginandgVisor bot 9fcf0b5b53 proc: invalidate task inodes when tasks are destroyed
PiperOrigin-RevId: 705785809
2024-12-13 00:58:08 -08:00
Andrei VaginandgVisor bot 5b33e4a3d8 Enable leak checkers for runsc tests
Updates #4572

PiperOrigin-RevId: 597307765
2024-01-10 11:30:58 -08:00
Andrei Vagin 5f4abad306 Fix a few typos
It is an idea of running codespell as part of our presubmit checks.
Before enabling it for new changes, let's fix what it has found.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-25 12:13:42 -07:00
Nicolas LacasseandgVisor bot 8c975e6e6e Mark some kernfs inode as Anonymous.
These inodes can never be part of a filesystem tree. They are nameless and
never have a parent.

This allows us to avoid taking a lock in kernfs.InotifyWithParent for such
anonymous inodes.

PiperOrigin-RevId: 538823227
2023-06-08 10:25:04 -07:00
Adin ScannellandgVisor bot 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Ayush RanjanandgVisor bot 175db901ca Replace pkg/refs with pkg/refsvfs2.
All VFS1 only bits have been deleted.

Updates #1624

PiperOrigin-RevId: 492273183
2022-12-01 12:46:11 -08:00
Ayush RanjanandgVisor bot 1fa3c06f1e Delete VFS1 completely.
- Delete pkg/sentry/fs/*.
- Move pkg/sentry/fs/fsutil out of VFS1 directory and remove VFS1 components.
- Remove remaining unused references to VFS1 from remaining codebase.
- Rename/refactor code to avoid even referencing VFS2, unless necessary.
- Rewrite VFS1-only tests to VFS2.

Updates #1624

PiperOrigin-RevId: 490064269
2022-11-21 13:57:52 -08:00
Ayush RanjanandgVisor bot bf4d27a6ca Add inotify support to kernfs and anonfs.
This is consistent with Linux. Some applications recursively add
files to inotify FD. They fail if they run into kernfs files
because inotify_add_watch(2) returns EPERM in that case.

PiperOrigin-RevId: 462642204
2022-07-22 09:45:24 -07:00
Kevin KrakauerandgVisor bot 019e0c9301 use atomicbitops, not sync/atomic, in refsvfs2
Since refsvfs2 are used in netstack, we should use atomicbitops to avoid
breaking 32-bit builds.

On 64-bit builds there is no performance difference.

PiperOrigin-RevId: 439687980
2022-04-05 15:16:01 -07:00
Rahat MahmoodandgVisor bot 8643fe526e cgroupfs: Implement task migration
PiperOrigin-RevId: 430273113
2022-02-22 12:43:54 -08:00
Fabricio VoznikaandgVisor bot dfcf798425 Fix epoll_ctl(2) regular files and dirs
Linux behaves differently for regular files and dirs for poll(2)/select(2)
compared to epoll_ctl(2). The latter returns EPERM for file and dirs.
I've also changed host FDs to behave like the underlying FD in regards
to epoll to keep it compatible with docker.

Fixes #7134

PiperOrigin-RevId: 429412692
2022-02-17 15:12:36 -08:00
Rahat MahmoodandgVisor bot d1dadc9c19 Remove dentry_cache_limit mount option from mqfs.
The dentry cache limit should only be set at filesystem creation.
Mqfs filesystems are created during IPC namespace creation and
mount(2)s return a reference to the shared filesystem
object. Modifying the cache limit once the filesystem is in use can
cause the cache to exceed the limit. Since this mount option is rarely
(never?) used, use a static cache size and remove the mount option.

Reported-by: syzbot+e89efb5faa374468b6bb@syzkaller.appspotmail.com
PiperOrigin-RevId: 425436253
2022-01-31 12:41:46 -08:00
Fabricio VoznikaandgVisor bot 9768009a79 Don't eat error from epoll_ctl EPOLL_CTL_ADD
Docker maps stdin to `/dev/null` which doesn't support epoll. Host FD
was ignoring the error and suceeding the epoll_ctl call from the
container, giving false impressing that epoll would be notified.

This required plumbing failure to all waiter.Waitable.EventRegister
callers and implementers.

Closes #6795

PiperOrigin-RevId: 414797621
2021-12-07 12:36:00 -08:00
Adin ScannellandgVisor bot 91f58d2cc8 Update Waitable API.
Instead of passing the event mask at registratrion time, pass the mask as part
of the waiter. This makes the mask immutable and simplifies the architecture of
waiters. This is also necessary for a future fix that will allow the fdnotifier
to keep persistent entries, as opposed to requiring constant updates.

This change is intended to be a no-op in terms of function. The only exception
is signalfd, where this mask was abused. To handle this case, the operation of
signalfd changed to allow one layer of indirection.

PiperOrigin-RevId: 409702998
2021-11-13 12:54:39 -08:00
Ayush RanjanandgVisor bot 7b8f19dc76 Simplify vfs.NewDisconnectedMount signature and callpoints.
vfs.NewDisconnectedMount has no error paths. Its much prettier without the
error return value.

Also simplify MountDisconnected which would immediately drop the refs taken by
NewDisconnectedMount. Instead make it directly call newMount.

PiperOrigin-RevId: 405767966
2021-10-26 17:00:07 -07:00
Ayush RanjanandgVisor bot 763d7e6e39 Obtain ref on root dentry in mqfs.GetFilesystem.
As documented in FilesystemType.GetFilesystem, a reference should be taken on
the returned dentry and filesystem by GetFilesystem implementation. mqfs did
not do that.

Additionally cleanup and clarify ref counting of dentry, filesystem and mount
in mqfs.

Reported-by: syzbot+a2c54bfb6e1525228e5f@syzkaller.appspotmail.com
Reported-by: syzbot+ccd305cdab11cfebbfff@syzkaller.appspotmail.com
PiperOrigin-RevId: 405700565
2021-10-26 11:59:21 -07:00
gVisor bot 14f4113924 Merge pull request #6345 from sudo-sturbia:mq/syscalls
PiperOrigin-RevId: 404901660
2021-10-21 16:05:53 -07:00
Zyad A. Ali 583e18501e Use one mutex for both Registry and RegistryImpl.
Updates #136
2021-09-28 20:43:52 +02:00
Zyad A. Ali 7df562d473 Implement Registry.FindOrCreate.
FindOrCreate implements the behaviour of mq_open(2).

Updates #136
2021-09-28 20:43:52 +02:00
Zyad A. Ali 13d36561b8 Return FDs in RegistryImpl functions and use Views.
Update RegistryImpl functions to return file descriptions, instead of
queues, and use Views in queue inodes.

Updates #136
2021-09-28 20:43:52 +02:00
Zyad A. Ali 7508a0efee Define mq.View and use it for mqfs.queueFD.
View makes it easier to handle O_RDONLY, O_WRONLY, and ORDWR options in
mq_open(2).

Updates #136
2021-09-28 20:43:52 +02:00
Zyad A. Ali 229c01552e Move filesystem creation from GetFilesystem to RegistryImpl.
Move root dentry and filesystem creation from GetFilesystem to
NewRegistryImpl, create IPCNamespace.InitPosixQueues to create a new
mqueue filesystem for each ipc namespace, and update GetFilesystem to
retreive fs and root dentry from IPCNamespace and return them.

Updates #136
2021-09-28 20:43:47 +02:00
Zyad A. Ali e452ecd495 Create mq.Registry and mqfs.RegistryImpl.
Define a POSIX message queue Registry and RegistryImpl in mq package,
implement RegistryImpl in mqfs, and add a Registry object to
IPCNamespace initialized at filesystem creation.

Updates #136
2021-09-17 11:16:07 +02:00
Zyad A. Ali 0061d0e4e5 Implement queueInode and queueFD in mqfs.
Implement inode and file description representing a POSIX message queue,
and other utilities needed to implement file operations.

Updates #136
2021-09-15 21:56:35 +02:00
Zyad A. Ali fc5469af61 Implement vfs.FilesystemType and kernfs.Filesystem for mqfs.
Updates #136
2021-09-15 21:56:35 +02:00