Commit Graph
5799 Commits
Author SHA1 Message Date
gVisor bot 41c56d467b Merge pull request #10996 from cweld510:cweld/optionally-close-unix-sockets-on-save
PiperOrigin-RevId: 684217787
2024-10-09 16:54:50 -07:00
gVisor bot 56b1ea0b5b Merge pull request #10990 from ignoramous:patch-5
PiperOrigin-RevId: 683708561
2024-10-08 11:49:08 -07:00
cweld510 db4ffada10 style feedback: remove newlines, fix import, remove stray comment 2024-10-07 22:39:13 +00:00
Etienne PerotandgVisor bot 1ea84d6db0 Add test that runs runsc do inside a non-gVisor container.
This is used in contexts such as Dangerzone:
https://gvisor.dev/blog/2024/09/23/safe-ride-into-the-dangerzone/

Updates issue #10944.

PiperOrigin-RevId: 682454284
2024-10-04 14:40:07 -07:00
cweld510 727bc9c72a Add and implement option to close unsaveable gofer-backed unix sockets
on save
2024-10-04 20:13:38 +00:00
ignoramousandGitHub ab3c4c85a3 tcpip/udp: defer mutex unlock 2024-10-05 00:14:04 +05:30
ignoramousandGitHub 741bf52370 tcpip/udp: document preconditions for endpoint.closeLocked() 2024-10-04 06:14:17 +05:30
ignoramousandGitHub 123173f839 tcpip/udp: avoid deadlock in forwader.CreateEndpoint 2024-10-04 06:04:38 +05:30
Ayush RanjanandgVisor bot cb418b7f09 Add kernel.Saver.OCIEnviron().
PiperOrigin-RevId: 682080366
2024-10-03 16:48:03 -07:00
Lucas ManningandgVisor bot a446b45d4d Ensure views returned by PullUp are owned exclusively by their packet.
PiperOrigin-RevId: 681977034
2024-10-03 12:12:57 -07:00
Nicolas LacasseandgVisor bot cceb04f05a Clean up host.TTYFileOperations.
We used to track the foreground process group & session on the
TTYFileOperation, but these are already tracked in kernel.TTY.ThreadGroup.

So remove TTYFileOperations.fgProcessGroup and .session, and replace them with
a kernel.TTY.

This is analogous to how sentry-internal tty's already work.

Updates #10925

PiperOrigin-RevId: 681957240
2024-10-03 11:25:52 -07:00
Konstantin BogomolovandgVisor bot a94f5e598f systrap: Replace all instances of unix.RawSyscall with pkg/hostsyscall variants.
PiperOrigin-RevId: 681941600
2024-10-03 10:48:09 -07:00
Nicolas LacasseandgVisor bot d5a9d523bb Implement /dev/tty for donated host TTYs
Fixes #10925

PiperOrigin-RevId: 681684673
2024-10-02 19:40:43 -07:00
Nicolas LacasseandgVisor bot 72193f12c9 Implement /dev/tty for sentry-internal ttys.
The /dev/tty acts as a replica for the current thread group's controlling
terminal.

In a follow-up, I will make /dev/tty work for donated host ttys.

Updates #10925

PiperOrigin-RevId: 681629892
2024-10-02 16:23:54 -07:00
Konstantin BogomolovandgVisor bot d3ce23c224 Fix improper use of RawSyscall in KVM
futex wait needs to be called surrounded by syscall.Entersyscall() and
syscall.Exitsyscall(), which RawSyscall does not do. It was a mistake
to substitute it.

PiperOrigin-RevId: 681629844
2024-10-02 16:18:06 -07:00
Andrei VaginandgVisor bot ca8d05a657 platform/kvm: refactor handleBluepillFault to reduce stack usage
PiperOrigin-RevId: 681217279
2024-10-01 17:09:18 -07:00
Jamie LiuandgVisor bot b99fd8711f kernel: fix lock order inversion in ThreadGroup.Release()
PiperOrigin-RevId: 681199251
2024-10-01 16:10:15 -07:00
Jamie LiuandgVisor bot baaaf47fc2 kernel: hold TaskSet mutex across exitPtrace() and exitChildren()
This just saves needlessly bouncing the mutex. Compare Linux
kernel/exit.c:exit_notify() => write_lock_irq(&tasklist_lock);
forget_original_parent() => exit_ptrace().

PiperOrigin-RevId: 681181467
2024-10-01 15:14:15 -07:00
Jamie LiuandgVisor bot a32d047f68 kernel: don't hold TaskSet.mu during most of Kernel.runCPUClockTicker()
The removed `tg.leader == nil` check doesn't actually affect the correctness of
the rest of the loop body.

PiperOrigin-RevId: 681163998
2024-10-01 14:25:47 -07:00
Konstantin BogomolovandgVisor bot 51fa369cf1 kvm: Replace all instances of unix.RawSyscall with pkg/hostsyscall variants.
These are not as important as the instances that have already been replaced,
because everything builds without these replacements. However, for consistency
and for the sake of a couple of less jumps, let's replace these too.

PiperOrigin-RevId: 681135990
2024-10-01 13:12:57 -07:00
Jamie LiuandgVisor bot 03bebc4402 kernel: add ThreadGroup.signalLock()
This allows "remote" locking of ThreadGroup.signalHandlers.mu without needing
to lock TaskSet.mu, analogously to Linux's lock_task_sighand().

This reveals a bug: kernel.Task.sendSignal[Timer]Locked() unintentionally
requires TaskSet.mu to be locked since it reads Task.exitState. To fix this,
use atomic memory operations on Task.exitState when required.

PiperOrigin-RevId: 681128063
2024-10-01 12:48:10 -07:00
Konstantin BogomolovandgVisor bot 4a0bf841d9 Don't return r2 from RawSyscalls.
In practice we don't seem to ever use it.

PiperOrigin-RevId: 681073641
2024-10-01 10:29:10 -07:00
Konstantin BogomolovandgVisor bot fa27ee0b23 Extract kvm variants of Syscall helpers to their own pkg.
These are already used in platform/kvm and pkg/sigframe. Maybe there will be
more in the future that are outside KVM, we don't want to keep redefining
these.

PiperOrigin-RevId: 680737814
2024-09-30 15:22:23 -07:00
Jamie LiuandgVisor bot a5459a26cb Add memmap.MMapOpts.RequirePlatformEffect and use where appropriate.
Per the comment for vfs.GenericProxyDeviceConfigureMMap(), this ensures that if
invalid arguments are provided to application mmap() for a proxy device file,
then an error is returned immediately (from host mmap()) rather than when
demand paging causes host mmap() to be invoked.

PiperOrigin-RevId: 680733678
2024-09-30 15:13:16 -07:00
Jamie LiuandgVisor bot a15559c56c mm: limit AddressSpace overmapping during async page loading
On platforms that do not create page table entries in
platform.AddressSpace.MapFile(precommit=false), i.e. platforms for which
platform.Platform.MapUnit() == 0, platform.AddressSpace.MapFile() is generally
implemented as some form of host mmap(), which only synchronously creates host
kernel VMAs (virtual memory areas) and creates page table entries lazily in
response to application faults. On such platforms, MM.mapAsLocked() creates the
largest possible host VMAs since doing so reduces future sentry-handled page
faults and has effectively no additional cost. However, when async page loading
is active, this must wait for all mapped pages to be loaded, which may result
in the faulting application blocking for significantly longer than expected (in
experiments, a single page fault could result in waiting for up to 64GB of data
to be loaded). In such cases, additionally constrain mapped sizes to limit wait
times.

PiperOrigin-RevId: 680699946
2024-09-30 13:39:11 -07:00