Commit Graph
36 Commits
Author SHA1 Message Date
Andrei VaginandgVisor bot f556917137 vfs: MountNamespace.Root() has to return a top mount of /
A few mounts can be mounted on top of `/`.

PiperOrigin-RevId: 558264274
2023-08-18 15:35:47 -07:00
Etienne PerotandgVisor bot d53fe574e0 cpuid: Initialize hostFeatureSet only when it's needed.
This moves the initialization of `cpuid.hostFeatureSet` out of package-level
`init` and instead moves it to an explicit `cpuid.Initialize()` function.

On AMD64, this saves about 512KiB of heap memory that would otherwise always
be live.

PiperOrigin-RevId: 514896323
2023-03-07 18:27:49 -08:00
Etienne PerotandgVisor bot ab715c16d0 seccheck: Initialize seccheck.Points only when needed.
This moves the initialization of `seccheck.Points` out of package-level
`init` and instead moves it to an explicit `seccheck.Initialize()` function.

On AMD64, this saves about 614KiB of heap memory that would otherwise always
be live.

PiperOrigin-RevId: 514813332
2023-03-07 12:53:27 -08:00
Adin ScannellandgVisor bot 2911d8c3b8 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Ayush RanjanandgVisor bot 64e8ac9ea1 Delete fsbridge.
Updates #1624

PiperOrigin-RevId: 492286535
2022-12-01 13:36:10 -08:00
Ayush RanjanandgVisor bot 1003ae8e93 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 7cac4e2732 Start cleaning up VFS1.
PiperOrigin-RevId: 486586072
2022-11-07 00:39:54 -08:00
Andrei VaginandgVisor bot 89c8e320fc Don't leak network namespaces
PiperOrigin-RevId: 454707336
2022-06-13 15:05:21 -07:00
Etienne PerotandgVisor bot ba547c9488 Replace use of undocumented GVISOR_KVM_DEV environment variable with flags.
This allows overriding the path used to access the kernel's KVM device file,
typically at `/dev/kvm`, with a flag-controlled path instead.

PiperOrigin-RevId: 431073099
2022-02-25 18:29:23 -08:00
Andrei Vagin 3ba699a85f Implement RLIMIT_NPROC
This is simplified version without supporting hierarchical
user-namespace counters.

Signed-off-by: Andrei Vagin <[email protected]>
2021-12-23 13:52:05 -08:00
Tamir DubersteinandgVisor bot cf294c7575 Move tcpip.Clock impl to Timekeeper
...and pass it explicitly.

This reverts commit 66a5628533.

PiperOrigin-RevId: 380039167
2021-06-17 14:02:05 -07:00
Tamir DubersteinandgVisor bot 0f2e81b30a Initialize metrics at init
Avoids a race condition at kernel initialization.

Updates #6057.

PiperOrigin-RevId: 377357723
2021-06-03 13:18:43 -07:00
Tamir DubersteinandgVisor bot 66a5628533 Initialize Kernel.Timekeeper before network NS
PiperOrigin-RevId: 375843579
2021-05-25 18:57:38 -07:00
Tamir DubersteinandgVisor bot 2ae673b180 Use specific fmt verbs (avoid %v)
Remove useless conversions. Avoid unhandled errors.

PiperOrigin-RevId: 375834275
2021-05-25 17:48:34 -07:00
Nayana BidariandgVisor bot 7ed59e3fbd Add weirdness sentry metric.
Weirdness metric contains fields to track the number of clock fallback,
partial result and vsyscalls. This metric will avoid the overhead of
having three different metrics (fallbackMetric, partialResultMetric,
vsyscallCount).

PiperOrigin-RevId: 369970218
2021-04-22 16:07:15 -07:00
Zach KoopmansandgVisor bot d8f34027b3 [syserror] Split usermem package
Split usermem package to help remove syserror dependency in go_marshal.
New hostarch package contains code not dependent on syserror.

PiperOrigin-RevId: 365651233
2021-03-29 13:30:21 -07:00
Adin ScannellandgVisor bot 0dab30d83f Fix simple mistakes identified by goreportcard.
These are primarily simplification and lint mistakes. However, minor
fixes are also included and tests added where appropriate.

PiperOrigin-RevId: 351425971
2021-01-12 12:38:22 -08:00
Jamie LiuandgVisor bot 0dede4687f Rename kernel.TaskContext to kernel.TaskImage.
This reduces confusion with context.Context (which is also relevant to
kernel.Tasks) and is consistent with existing function kernel.LoadTaskImage().

PiperOrigin-RevId: 342167298
2020-11-12 17:39:19 -08:00
Dean DengandgVisor bot b2ee1accb2 [vfs2] Fix fork reference leaks.
PiperOrigin-RevId: 337919424
2020-10-19 13:20:13 -07:00
Dean DengandgVisor bot 5fd9ec997d [vfs2] Don't take reference in Task.MountNamespaceVFS2 and MountNamespace.Root.
This fixes reference leaks related to accidentally forgetting to DecRef()
after calling one or the other.

PiperOrigin-RevId: 336918922
2020-10-13 11:31:22 -07:00
gVisor bot adcd87c8ef Internal change.
PiperOrigin-RevId: 324826968
2020-08-04 09:31:11 -07:00
Nayana BidariandgVisor bot 4a8d0d3f20 Plumbing context.Context to DecRef() and Release().
context is passed to DecRef() and Release() which is
needed for SO_LINGER implementation.

PiperOrigin-RevId: 324672584
2020-08-03 13:36:05 -07:00
gVisor bot 517ba1fffe Merge pull request #2672 from amscanne:shim-integrated
PiperOrigin-RevId: 321053634
2020-07-13 16:10:58 -07:00
Fabricio VoznikaandgVisor bot 2ce8f9a6d0 Add shared mount hints to VFS2
Container restart test is disabled for VFS2 for now.

Updates #1487

PiperOrigin-RevId: 320296401
2020-07-08 17:12:29 -07:00
Ayush RanjanandgVisor bot d912e30c06 [vfs2] Remove VFS1 usage in VDSO.
Removed VDSO dependency on VFS1.

Resolves #2921

PiperOrigin-RevId: 320122176
2020-07-07 21:37:08 -07:00
Nicolas LacasseandgVisor bot e9e638bf1b Allow passing root file type to tmpfs.
PiperOrigin-RevId: 304053357
2020-03-31 15:02:57 -07:00
Fabricio VoznikaandgVisor bot a222766a71 Add remaining procfs files
Closes #1195

PiperOrigin-RevId: 300867055
2020-03-13 18:57:07 -07:00
gVisor botandCopybara-Service 27ef5c3926 Initial network namespace support.
TCP/IP will work with netstack networking. hostinet doesn't work, and sockets
will have the same behavior as it is now.

Before the userspace is able to create device, the default loopback device can
be used to test.

/proc/net and /sys/net will still be connected to the root network stack; this
is the same behavior now.

Issue #1833

PiperOrigin-RevId: 296309389
2020-02-20 15:20:40 -08:00
gVisor bot d471ab81d2 Allow vfs.IterDirentsCallback.Handle() to return an error.
This is easier than storing errors from e.g. CopyOut in the callback.

PiperOrigin-RevId: 295230021
2020-02-14 14:40:35 -08:00
gVisor bot 973cc2db84 Inline vfs.VirtualFilesystem in Kernel struct
This saves one pointer dereference per VFS access.

Updates #1623

PiperOrigin-RevId: 295216176
2020-02-14 13:40:39 -08:00
gVisor bot 649b11f624 Plumb VFS2 inside the Sentry
- Added fsbridge package with interface that can be used to open
  and read from VFS1 and VFS2 files.
- Converted ELF loader to use fsbridge
- Added VFS2 types to FSContext
- Added vfs.MountNamespace to ThreadGroup

Updates #1623

PiperOrigin-RevId: 295183950
2020-02-14 11:12:47 -08:00
Fabricio VoznikaandgVisor bot 0bc53075f9 Remove argument from vfs.MountNamespace.DecRef()
Updates #1035

PiperOrigin-RevId: 293194631
2020-02-04 11:48:36 -08:00
Adin ScannellandgVisor bot 4368058004 Update package locations.
Because the abi will depend on the core types for marshalling (usermem,
context, safemem, safecopy), these need to be flattened from the sentry
directory. These packages contain no sentry-specific details.

PiperOrigin-RevId: 291811289
2020-01-27 15:31:32 -08:00
Adin ScannellandgVisor bot 5cd5c2536a Standardize on tools directory.
PiperOrigin-RevId: 291745021
2020-01-27 12:21:00 -08:00
Rahat MahmoodandgVisor bot 012232486a De-duplicate common test functionality for VFS2 filesystems.
PiperOrigin-RevId: 291041576
2020-01-22 15:16:21 -08:00
Rahat MahmoodandgVisor bot 5ba6c6191b Implement sysfs.
PiperOrigin-RevId: 290822487
2020-01-21 15:13:26 -08:00