Create WithValues in pkg/context/context.go to replace multiple values using
a map. Update runsc/boot/restore.go to use WithValues instead of multiple
WithValue calls.
PiperOrigin-RevId: 914896863
When ctx is of type `kernel.taskAsyncContext`, calling
`kernel.TaskFromContext(ctx)` on it returns the original task (even though this
is an async goroutine). And then calling methods like Block() on it would panic
because it expects to be running on the task goroutine. Furthermore, the Task
could have exited so working on a dead task could cause other issues too.
Instead, use `kernel.taskAsyncContext` methods via the context.Context
interface. This change adds BlockWithTimeout() to the context interface and
implements it for context.NoTask. kernel.Task already implements this.
The current implementation of context.NoTask.BlockWithTimeoutOn was buggy:
- It returned true when the desired event occurred OR when the timeout expired.
However, context.Blocker interface docstring suggest that true should only
be returned when the desired event occurs, which kernel.Task implements
correctly.
- Instead of returning the remaining timeout, it returned the duration passed
since the timer started.
Fixed these two bugs and made the implementations of kernel.Task and
context.NoTask consistent with one another.
Also clarified docstrings for some Task.Block*() methods about the precondition
of "The caller must be running on the task goroutine.".
Reported-by: [email protected]
Reported-by: [email protected]
PiperOrigin-RevId: 853557307
bgContext is set during package initialization. However, the global
logger's SetTarget() method doesn't apply to instances of
context.Background() loaded after the first one.
See https://github.com/google/gvisor/issues/7795
This change adapts the existing context to use more suitable non-channel-based
methods. This is a requisite for migrating the kernel internals to a
sleeper-based notification mechanism.
The last uses of amutex outside those migrated as part of this change were
dropped in a previous change. Since amutex depends on the channel-based
implementation, this package is also deleted as part of this change.
PiperOrigin-RevId: 415189675
This function doesn't belong in the global context package. Move to a more
suitable package to break the dependency cycle.
PiperOrigin-RevId: 406942122
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
The comments in the ticket indicate that this behavior
is fine and that the ticket should be closed, so we shouldn't
need pointers to the ticket.
PiperOrigin-RevId: 306266071
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