Commit Graph
8172 Commits
Author SHA1 Message Date
Lucas ManningandgVisor bot aa4e302c75 Automated rollback of changelist 558922801
PiperOrigin-RevId: 566731014
2023-09-19 13:46:56 -07:00
Etienne PerotandgVisor bot d3ddef3e73 Add ABI for keyctl(2).
PiperOrigin-RevId: 566711348
2023-09-19 12:37:33 -07:00
Etienne PerotandgVisor bot b82e8e1eba KVM: Remove _ prefix from KVM ioctl constants.
This is useful to be able to refer to them from external packages, such as
to represent the `ioctl(2)` syscall profile that the Sentry has with the
KVM platform.

PiperOrigin-RevId: 566705114
2023-09-19 12:14:19 -07:00
Ayush RanjanandgVisor bot 3aa66befb2 Handle arbitrarily large Fuse Dirent Namelen.
If FUSEDirent.Namelen is larger than the remaining payload size, then the
dirent is probably invalid. We should skip it.

PiperOrigin-RevId: 566678679
2023-09-19 10:48:35 -07:00
Zach KoopmansandgVisor bot 886ea9af25 Move pytorch benchmark to GPU directory.
The pytorch image is huge, about 7-8 GB. This doesn't
need to be downloaded with the other benchmark images. Move
it to a GPU directory to speed up benchmark runs.

PiperOrigin-RevId: 566449296
2023-09-18 16:46:52 -07:00
Nicolas LacasseandgVisor bot 5530811417 Tweaks to containerd tests and helpers.
PiperOrigin-RevId: 565839195
2023-09-15 20:02:41 -07:00
Ayush RanjanandgVisor bot c4e72d9e0e Remove peer credential check from control server.
The peer credential check worked by querying the peer's UID using SO_PEERCRED.
However, when sandbox is configured with custom UID/GID mappings, which it is
in the following situations:
1. When not using directfs, sandbox has a mapping of only `65534:65534:1`. So
   all other non-65534 UIDs are unmmaped.
2. When using directfs with userns-remap. The sandbox has the same UID/GID
   mapping as the container.

In these cases, when the root user tries to connect, the host root user is not
mapped. Unmapped IDs are translated to overflowuid/gid, which happens to
default to 65534. This leads to unexpected results:
- Without directfs, this check allows any connection, because sandbox is also
  running as nobody/65534.
- In the directfs+userns-remap case, all connections are denied.

This check doesn't really enforce anything. Hence remove it.

The real enforcement mechanism is the file mode of the unix domain socket over
which the connection happens. The socket file's mode depends on umask, which
defaults to 022. Hence only the user which creates the sandbox via
`runsc create` has write permission on this socket. So only the sandbox creator
or root can connect to the sandbox, as intended.

Fixes #9356

PiperOrigin-RevId: 565836818
2023-09-15 19:44:22 -07:00
Ayush RanjanandgVisor bot bea6d33185 Add state:"nosave" annotation to nvproxy.objsMu.
With this, checkpoint command succeeds on nvproxy containers.

Updates #9363.

PiperOrigin-RevId: 565786118
2023-09-15 14:58:29 -07:00
Ayush RanjanandgVisor bot ea7208fb9d Do not use abstract sockets for control server.
Any user can connect to an abstract socket. See "Abstract sockets" section in
unix(7). Filesystem UDS requires write permission to connect to. Hence, file
mode is used to protect the server.

PiperOrigin-RevId: 565759783
2023-09-15 13:13:26 -07:00
Ayush RanjanandgVisor bot 8698c0a353 Exempt proposal issues from being closed as stale.
Proposals usually have more longevity and contain interesting ideas.
Also clean up "new feature" and "enhancement" from the list. Those labels don't
exist in gVisor repo.

PiperOrigin-RevId: 565735357
2023-09-15 11:41:00 -07:00
gVisor bot 2f0bbd0306 Merge pull request #9381 from testwill:typo
PiperOrigin-RevId: 565729064
2023-09-15 11:19:57 -07:00
guangwuandGitHub 0fdab343da fix: successfully typo 2023-09-15 14:47:10 +08:00
Ayush RanjanandgVisor bot 31084cca90 Handle large control socket paths.
UDS connect and bind fail when the socket path being used is more than 107 in
length. Shorten the path using procfs: "/proc/self/fd/{parentFD}/{sockName)"

This avoids falling back to using abstract sockets in some instances.

Suggested-by: Andrei Vagin <[email protected]>
PiperOrigin-RevId: 565557006
2023-09-14 20:56:26 -07:00
gVisor bot d25a2265cf Merge pull request #9377 from milantracy:codeqlstatus
PiperOrigin-RevId: 565522379
2023-09-14 17:26:31 -07:00
Lucas ManningandgVisor bot 961f052fa3 Enhance stale action with more labels and a smaller close window.
The action also ignores a few more labels.

PiperOrigin-RevId: 565494794
2023-09-14 15:34:53 -07:00
Jing Chen 6bdc401440 Add CodeQL status badge for its visibility. 2023-09-14 15:30:55 -07:00
Lucas ManningandgVisor bot 98450b2895 Change namespace cloning so that it clones mounts depth-first.
This saves on allocations.

This change is a subset of the changes in cl/563529897 and cl/563752003.
Committing this change in more discrete parts will help narrow down the
causes of b/299603749.

PiperOrigin-RevId: 565484026
2023-09-14 14:53:26 -07:00
Ayush RanjanandgVisor bot 8efec607d2 Additionally expect the custom tos/tclass in TOS_TCLASS_EXPECT_DEFAULT case.
PiperOrigin-RevId: 565458888
2023-09-14 13:25:12 -07:00
Andrei VaginandgVisor bot 2af2ece59a images: use gcr.io/syzkaller/syzbot as the base for syzkaller images
gcr.io/syzkaller/env isn't built for ARM64.

PiperOrigin-RevId: 565419016
2023-09-14 11:04:00 -07:00
Lucas ManningandgVisor bot 0f3eb8f351 Fix CodeQL so that it does not fail the github check.
PiperOrigin-RevId: 565119657
2023-09-13 12:01:52 -07:00
Lucas ManningandgVisor bot 50d0c99691 Add "type: enhancement" to labels protected from the stale action.
PiperOrigin-RevId: 565089338
2023-09-13 10:25:05 -07:00
gVisor bot f47f658e8d Merge pull request #9215 from ekzhang:ekzhang/perf-nvidia-cli-info
PiperOrigin-RevId: 564882593
2023-09-12 17:37:50 -07:00
gVisor bot cfa5c8a580 Merge pull request #9359 from milantracy:codeqlconfig
PiperOrigin-RevId: 564786128
2023-09-12 11:41:11 -07:00
Jamie LiuandgVisor bot 21e36bacfc cgroupfs: do not return errors from strconv.ParseInt() to write()
Arbitrary errors are not convertible to errnos for syscall return and cause the
sentry to panic.

PiperOrigin-RevId: 564782206
2023-09-12 11:29:05 -07:00
Lucas ManningandgVisor bot ffa98cacb2 Increase stale action ops per run.
Right now we're capped at 30, but have 569 open issues and 192 open PRs.

PiperOrigin-RevId: 564760282
2023-09-12 10:23:03 -07:00
Eric Zhang 27ae46b4af perf: Remove call to nvidia-container-cli info
This call is repeated on every container startup sequence, but it is expensive, consistently taking between 2-3 seconds to run each time. This adds a significant amount of startup latency to every container. From `strace` output, the main issue appears to be a call to `openat(AT_FDCWD, "/dev/nvidia0", O_RDWR|O_CLOEXEC)`. The first time this is called, it creates a new open device file descriptor and blocks for 2 seconds while doing so. This was measured on a `g4dn.2xlarge` instance on AWS, running a Tesla T4 GPU.

For comparison, the `nvidia-container-prestart-hook` for runc also runs `nvidia-container-cli` during container boot, but it only calls it once for the `configure` command. gVisor appears to call it twice, once for `info` and then for `configure`.

By removing the `info` call, or at least only running it when the GPU device files are not already present on the host, GPU container startups can be 2-3 seconds faster.

Does this sound reasonable? I'm not actually familiar with why the `/dev/nvidia0` file takes 2-3 seconds to open, or why GPU device files need to be explicitly loaded. But I tested the change, and gVisor nvproxy still works.
2023-09-11 19:51:18 +00:00
Zach KoopmansandgVisor bot 992f1b4e93 Don't build tensorflow image on ARM.
The upload image test is failing due to the tensorflow image not being
supported on ARM.

PiperOrigin-RevId: 564458336
2023-09-11 12:01:06 -07:00
Jing Chen 007002cfe9 Add initial CodeQL config for gVisor. 2023-09-11 11:41:47 -07:00
Ayush RanjanandgVisor bot c5b6d99fff Rollback c8d23ad2a4 and f36ba56090.
Syzkaller is reporting crashes relating to changes made by these commits.
Rolling back for now. Should be rolled forward with fix.

Reported-by: [email protected]
PiperOrigin-RevId: 564000728
release-20230911.0
2023-09-09 06:50:38 -07:00
Ayush RanjanandgVisor bot 125b741d86 Return user_mss if user_mss is set and socket is unconnected.
Has the same effect as Linux commit 34dfde4ad87b ("tcp: Return user_mss for
TCP_MAXSEG in CLOSE/LISTEN state if user_mss set").

Updated test to accept both values (default and user set) so test works on
newer and older kernels.

PiperOrigin-RevId: 563844012
2023-09-08 13:57:42 -07:00
Lucas ManningandgVisor bot 33c1b3856d Fix debug builds.
This change also adds instructions for using a debugger with syscall tests.

Fixes #9039

PiperOrigin-RevId: 563576842
2023-09-07 16:28:00 -07:00
Lucas ManningandgVisor bot f36ba56090 Fix cwd/root update method during namespace cloning.
The previous implementation incorrectly assumed order would be preserved
in the map.

Reported-by: [email protected]
PiperOrigin-RevId: 563529897
2023-09-07 13:37:20 -07:00
Lucas ManningandgVisor bot 2e59721b8b Fix github workflow test.
PiperOrigin-RevId: 563466164
2023-09-07 10:08:15 -07:00
Jing ChenandgVisor bot 6cbd7dbd93 Let devices cgroup add/remove rules via devices.allow and devices.deny.
PiperOrigin-RevId: 563261158
2023-09-06 17:27:02 -07:00
Lucas ManningandgVisor bot c8d23ad2a4 Abstract mount tree cloning into its own mount method.
When copying a mount tree, new child mounts are added to a mount's
pending list. Each of these mounts has its pending mountpoint already set
with setKey. Eventually this method will be used to enable recursive binds.

PiperOrigin-RevId: 563236298
2023-09-06 15:43:02 -07:00
Ghanan GowripalanandgVisor bot ce71f3cf3b Automated rollback of changelist 536743330
PiperOrigin-RevId: 563224104
2023-09-06 14:58:03 -07:00
Ayush RanjanandgVisor bot 09db44a7e2 Add more justification about why shared mount propagation is not allowed.
Updates #9324

PiperOrigin-RevId: 563208592
2023-09-06 14:06:31 -07:00
gVisor bot a423565638 Merge pull request #9339 from kevinGC:tcsetsf2
PiperOrigin-RevId: 563207341
2023-09-06 13:58:08 -07:00
gVisor bot 3155f15acd Merge pull request #9336 from thundergolfer:jonathon/dev-pts-eof-handling
PiperOrigin-RevId: 563199056
2023-09-06 13:29:19 -07:00
Jing ChenandgVisor bot 090d92a726 Have lgetxattr return ENODATA.
It is a workaround to lgetxattr/lsetxattr working with security.capacity when running docker in gvisor.

PiperOrigin-RevId: 563194162
2023-09-06 13:13:19 -07:00
gVisor bot faebee65d0 Merge pull request #9327 from kevinGC:benchmarkxdp
PiperOrigin-RevId: 563182220
2023-09-06 12:30:10 -07:00
Lucas ManningandgVisor bot e7a86ddc32 Split the ring implementation into its own package.
The ring data structure's requires it's own implementation of Entry. With
the new version you can more easily be part of multiple rings at once. Also,
a user who wants to use ilist probably doesn't need ring as well, so it makes
sense to separate the two.

PiperOrigin-RevId: 563151782
2023-09-06 10:54:41 -07:00
Lucas ManningandgVisor bot 514b397ae6 Add a github workflow that marks issues and PRs as stale.
PiperOrigin-RevId: 563136967
2023-09-06 10:05:13 -07:00
Nicolas LacasseandgVisor bot fd8f39c53b Emit SentryTcpListenEvent when the application listens on a tcp port.
PiperOrigin-RevId: 562957239
2023-09-05 19:15:45 -07:00
Jonathon Belotti 7d9e612057 Fix EOF (^D) handling in devpts (partially addr #9333) 2023-09-06 01:18:18 +00:00
Lucas ManningandgVisor bot 621c632afc A few fixes to run tests on 6.2+ kernels
* disable broken socket_inet_loopback test // Lucas Manning
* disable lseek tests on anon inodes. They have been broken by
commit e7478158e1378325907edfdd960eca98a1be405b
Date:   Wed Jun 29 15:06:57 2022 +0200
    fs: clear or set FMODE_LSEEK based on llseek function

* don't check memory.kmem.limit_in_bytes, it has been deprecated and dropped:
commit 86327e8eb94c52eca4f93cfece2e29d1bf52acbf
Date:   Tue Jul 4 13:52:40 2023 +0200
    memcg: drop kmem.limit_in_bytes
commit 58056f77502f3567b760c9a8fc8d2e9081515b2d
Date:   Fri Nov 5 13:37:44 2021 -0700
    memcg, kmem: further deprecate kmem.limit_in_bytes
commit 0158115f702b0ba208ab0b5adf44cae99b3ebcc7
Date:   Mon Sep 23 15:37:22 2019 -0700
    memcg, kmem: deprecate kmem.limit_in_bytes
PiperOrigin-RevId: 562915457
2023-09-05 15:51:21 -07:00
Kevin Krakauer dbbce69479 tty: enable TCSETSF
While there is a difference between flavors of this ioctl (`TCSETS`,
`TCSETSF`, `TCSETSW`), in practice it seems not to matter. We should let
users call `TCSETSF` and can implement those differences if necessary.
2023-09-05 09:53:50 -07:00
Kevin Krakauer 7c236fdb07 netstack: benchmark xdp endpoint
This just swaps out the fdbased endpoint for an XDP one. Some related
changes in here:

- Moved the AF_XDP BPF program into its own Go package so it can be
  shared.
- Added a flag to tcp_benchmark to disable user namespaces. This helps
  when running as root, which is required to install BPF programs.
2023-08-31 11:09:15 -07:00
Lucas ManningandgVisor bot cec42923e3 Clean up mount tests.
This change makes it simpler to write mount tests that examine the optional
field of mountinfo. It also cleans up the mounts in existing tests so they
don't pollute mountinfo after exit.

PiperOrigin-RevId: 561439839
release-20230904.0
2023-08-30 13:56:03 -07:00
Etienne PerotandgVisor bot db458d560e Verify that the Container and Sandbox types are JSON-serializable.
PiperOrigin-RevId: 561273043
2023-08-30 02:08:30 -07:00