18 Commits
Author SHA1 Message Date
Shailend ChandandgVisor bot 416a279cf2 clone: Honor CLONE_PARENT
Thus far we were silently ignoring this flag.

While writing the syscall test for this change I realized that we were
using the async-signal-unsafe `FileDescriptor.reset()` (It's unsafe because
it eventually calls `getenv()`) and `exit()`
in various `fork()` contexts, so I fixed the affected syscall tests.

PiperOrigin-RevId: 925064507
2026-06-01 20:13:23 -07:00
Ryan El KochtaandgVisor bot 7d9743c4a0 clone: support CLONE_CLEAR_SIGHAND
Clears all non-SIG_IGN signal handlers when clone() is called with
CLONE_CLEAR_SIGHAND, just like Linux.

PiperOrigin-RevId: 922974581
2026-05-28 14:25:40 -07:00
Jimmy TranandgVisor bot 544a60277d kvm: RSEQ: Add RSEQ support
This change adds RSEQ support for platform/kvm. RSEQ is disabled by default.

To support RSEQ, the KVM platform must provide two key capabilities:
 (1) A stable, unique CPU ID.
 (2) A way to detect when a thread as been preempted.

This implementation provides the necessary support as follows:
CPU ID:
  - platform/kvm now advertises the KVM vCPU ID as the cpu_id

Preemption Detection:
  - Compares the last context the CPU ran against the current context being
 scheduled.
  - Compares the context's rseqCPU and CPU ID retrieved by the platform

To facilitate this, several new methods are introduced to the platform
interface and implemented by platform/kvm:
 - HasCpuNumbers()
 - NumCPUs()
 - DetectsCPUPreemption()
 - PreemptCpu()
 - PreemptAllCpus()

A new user-facing KVM specific option, use_cpu_numbers, is introduced to
effectively feature guard RSEQ. When use_cpu_numbers is true, vCPU IDs are
exposed to the guest, enabling RSEQ support. Setting it to false reverts to
the previous behavior and effectively disables RSEQ for applications that
rely on it.

PiperOrigin-RevId: 844846226
2025-12-15 11:14:18 -08:00
Andrei Vagin 67266e9403 Fix a few typos 2025-01-29 21:16:51 -08:00
Lucas ManningandgVisor bot 165abf752f Fix small logic bug with CLONE_NEWUSER|CLONE_NEWNS in clone.
The new mount namespace was being created with the old user namespace,
not the new one. This led to permission errors when creating new mounts.

PiperOrigin-RevId: 676489580
2024-09-19 11:24:15 -07:00
Jamie LiuandgVisor bot 115e60866d Use 1<<63 as non-canonical address in fork test.
1<<48 is not non-canonical on x86-64 CPUs with 5-level paging enabled.

PiperOrigin-RevId: 599935552
2024-01-19 14:24:27 -08:00
gVisor bot 74b2c5a62b Internal change.
PiperOrigin-RevId: 568695436
2023-09-26 17:35:33 -07:00
Shambhavi SrivastavaandgVisor bot 884e65cf41 Automated rollback of changelist 557871250
PiperOrigin-RevId: 560158129
2023-08-25 11:58:29 -07:00
Nicolas LacasseandgVisor bot 5dc1f9fa34 Automated rollback of changelist 554554034
PiperOrigin-RevId: 557871250
2023-08-17 10:50:10 -07:00
Shambhavi SrivastavaandgVisor bot f75fcdfa83 Implementing clone3
Updates #8585

PiperOrigin-RevId: 554554034
2023-08-07 12:19:32 -07:00
Andrei Vagin 3445db339d Fix all c++ compile time warnings 2023-03-09 19:01:00 -08:00
Haibo Xu 30a4313ab3 Enable syscall fork_test on arm64.
Signed-off-by: Haibo Xu <[email protected]>
Change-Id: I033692bcf4f8139df29e369a12b150d10fccbe32
2020-04-10 09:39:50 +08:00
Adin ScannellandgVisor bot 456f4ac3f1 Add notes to relevant tests.
These were out-of-band notes that can help provide additional context
and simplify automated imports.

PiperOrigin-RevId: 293525915
2020-02-05 22:46:35 -08:00
Haibo Xu 7ec3e71e03 Enable build of test/syscall tests on arm64.
Signed-off-by: Haibo Xu <[email protected]>
Change-Id: I277d6c708bbf5c3edd7c3568941cfd01dc122e17
2020-01-17 07:39:57 +00:00
Adin ScannellandgVisor bot 3b8d99f217 Import and structure cleanup.
PiperOrigin-RevId: 281795269
2019-11-21 11:41:30 -08:00
Michael PrattandShentubot 4d52a55201 Change copyright notice to "The gVisor Authors"
Based on the guidelines at
https://opensource.google.com/docs/releasing/authors/.

1. $ rg -l "Google LLC" | xargs sed -i 's/Google LLC.*/The gVisor Authors./'
2. Manual fixup of "Google Inc" references.
3. Add AUTHORS file. Authors may request to be added to this file.
4. Point netstack AUTHORS to gVisor AUTHORS. Drop CONTRIBUTORS.

Fixes #209

PiperOrigin-RevId: 245823212
Change-Id: I64530b24ad021a7d683137459cafc510f5ee1de9
2019-04-29 14:26:23 -07:00
Jamie LiuandShentubot bb47d8a545 Fix clone(CLONE_NEWUSER).
- Use new user namespace for namespace creation checks.

- Ensure userns is never nil since it's used by other namespaces.

PiperOrigin-RevId: 234673175
Change-Id: I4b9d9d1e63ce4e24362089793961a996f7540cd9
2019-02-19 14:20:05 -08:00
Brian GeffonandShentubot d3bc79bc84 Open source system call tests.
PiperOrigin-RevId: 224886231
Change-Id: I0fccb4d994601739d8b16b1d4e6b31f40297fb22
2018-12-10 14:42:34 -08:00