18 Commits
Author SHA1 Message Date
Fabricio VoznikaandgVisor bot 331d6af443 Add WithValues to context package and use it in restore.go
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
2026-05-13 09:09:18 -07:00
gVisor bot 7465eeb020 Merge pull request #12598 from tamird:nogo-more-checks
PiperOrigin-RevId: 873002517
2026-02-20 11:35:37 -08:00
Jamie LiuandgVisor bot d7996a5d9b Remove "AddressSpace activation".
PiperOrigin-RevId: 869302553
2026-02-12 14:55:06 -08:00
Tamir Duberstein 93fa6d63f5 Fix S1009 violations and drop suppression 2026-02-10 11:56:12 -08:00
Ayush RanjanandgVisor bot 154327a661 netstack: Use ctx.BlockWithTimeout() directly while releasing socket.
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
2026-01-07 22:17:38 -08:00
Jamie LiuandgVisor bot 27a9d71189 Check for fatal signals and reset watchdog during MM.mapASLocked().
PiperOrigin-RevId: 777697337
2025-06-30 13:42:06 -07:00
Lucas ManningandgVisor bot ce0b340d92 Remove dependency on linux packages in netstack.
PiperOrigin-RevId: 536560224
2023-05-30 18:06:41 -07:00
Lucas ManningandgVisor bot 5e8ed38c2f Change FUSE so that is no longer dependent on kernel tasks.
Filesystem operations are sometimes performed outside of the context of
a kernel task.

PiperOrigin-RevId: 533271322
2023-05-18 15:41:32 -07:00
Adin ScannellandgVisor bot 2911d8c3b8 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Kevin KrakauerandgVisor bot 3a76efe831 convert uses of interface{} to any
Done via:
  find . -name "*.go" | xargs sed -i -E 's/interface\{\}/any/g'

PiperOrigin-RevId: 487033228
2022-11-08 13:14:06 -08:00
skepticfx 4ca75d8425 context: initialize and use bgContext once
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
2022-07-14 12:09:58 -07:00
Ayush RanjanandgVisor bot 2026e1f078 Reformat codebase.
PiperOrigin-RevId: 449358041
2022-05-17 17:48:35 -07:00
Adin ScannellandgVisor bot 140b4e80f6 Align Context API with kernel internals.
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
2021-12-08 23:51:37 -08:00
Adin ScannellandgVisor bot fb913b87e1 Move ThreadGroupIDFromContext to kernel/auth.
This function doesn't belong in the global context package. Move to a more
suitable package to break the dependency cycle.

PiperOrigin-RevId: 406942122
2021-11-01 16:07:40 -07:00
Jamie LiuandgVisor bot 114d68adb8 Support VFS2 save/restore.
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
2020-10-23 17:48:33 -07:00
Jamie LiuandgVisor bot 7d030092bd Invert dependency between the context and amutex packages.
This is to allow the syserror package to depend on the context package in a
future change.

PiperOrigin-RevId: 331866252
2020-09-15 15:14:53 -07:00
Jon BuddandgVisor bot 9043a0bb9e Remove obsolete TODOs for b/38173783
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
2020-04-13 11:02:14 -07: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