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
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
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
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
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
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
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
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
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