125 Commits

Author SHA1 Message Date
Ayush Ranjan f06d4e7ebe goferfs: Add S/R support for open FDs to deleted files.
This support is only needed when the gofer mount in question is writable.
By default, the rootfs has an overlayfs applied, so the gofer lower layer is
not writabled. But if you are using --overlay2=none, then this change should
allow you to save sandbox with open FDs to deleted files in rootfs.

Updates #11425

PiperOrigin-RevId: 733021267
2025-03-03 12:38:10 -08:00
Jamie Liu b4cc9c572d test/runner: ignore warnings about rlimits being lower than recommended
PiperOrigin-RevId: 732302179
2025-02-28 16:59:42 -08:00
Jamie Liu 4a157b8e90 test/runner: do not emit --gtest_filter=main.test
PiperOrigin-RevId: 732286578
2025-02-28 16:00:05 -08:00
Jamie Liu 3885a281f2 test: add syscall_test() perf argument
PiperOrigin-RevId: 732194076
2025-02-28 11:05:10 -08:00
Nayana Bidari f6b843d9a6 Add tests with netstack s/r enabled.
PiperOrigin-RevId: 722790574
2025-02-03 14:12:03 -08:00
Koichi Shiraishi 0cf77c02f8 all: remove use io/ioutil deprecated package & fix some deprecated thing
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2024-10-10 20:36:24 +09:00
Etienne Perot 8e601582c2 Make runsc aware of host kernel settings and offer to tweak them.
This adds a `hostsettings` package which can be used to check and
optionally automatically adjust host kernel settings.

This currently covers six kernel settings:

  - `/proc/sys/kernel/yama/ptrace_scope`: must set to 0 or 1 when using
    `ptrace`.
  - `/proc/sys/user/max_user_namespaces`: must be >= 2, but also
    suggest increasing it further if low.
  - `/proc/sys/kernel/unprivileged_userns_clone`: Must be enabled in
    rootless mode.
  - `/proc/sys/kernel/unprivileged_userns_apparmor_policy`: Same.
  - `/proc/sys/vm/max_map_count`: suggest increasing max host VMAs.
  - `/sys/kernel/mm/transparent_hugepage/shmem_enabled`: suggest turning
    on transparent hugepages.

This is flag-gated; by default `runsc` only checks that these settings
are optimal, but only warns if they are not optimal (unless marked as
mandatory). Other flag settings can be used to either bypass this process
entirely (to avoid the small startup overhead this adds), or to make it
auto-adjust any suboptiomal kernel settings, either on a best-effort or
mandatory basis.

Updates issue #5964
Updates issue #9006

PiperOrigin-RevId: 683375555
2024-10-07 16:51:35 -07:00
Andrei Vagin c3fe152a48 test: add the rtnetlink test suit
It is much easier to create complex configurations from bash scripts with help
of the iproute2 tools.

PiperOrigin-RevId: 646286415
2024-06-24 18:25:26 -07:00
Etienne Perot ad8efe283b Unbreak coverage-enabled test runs of gVisor syscall tests.
Coverage files now have their own subdirectory.

Also add useful extra logging, and rename the log directory from `runsc.log`
(which sounds like a filename) to `runsc-logs`.

PiperOrigin-RevId: 642125227
2024-06-10 21:26:12 -07:00
Ayush Ranjan 68fa5032f1 Fix test runner to create per-command debug log files.
As of right now, all runsc logs from all commands are concatenated into one
file named "runsc.log". Instead create "runsc.log" directory which will
contain a log file for each runsc command. This is easier to inspect, specially
for save/restore tests.

This was changed in 5b33e4a3d8 ("Enable leak checkers for runsc tests") and
one-log-file approach was used to check for warnings from only one file.
The warning checking code has been fixed to work with this directory approach.

PiperOrigin-RevId: 641282534
2024-06-07 10:07:20 -07:00
Nicolas Lacasse 6fae8b623f Log warnings when runsc tries to open/connect to host fifos or UDS
...but is not configured to do so.

The warning says which flag to turn on to make this work.

PiperOrigin-RevId: 632620127
2024-05-10 15:35:03 -07:00
Ayush Ranjan 5e9207a966 Create separate pages.img checkpoint file when compression=none.
PiperOrigin-RevId: 624210535
2024-04-12 09:57:06 -07:00
Nayana Bidari be1a31aa23 Add save-resume variant to syscall tests.
Adds the save-resume variant to all syscall tests. These tests save/checkpoint
the sandbox for every syscall in the test and then resume.

PiperOrigin-RevId: 623601440
2024-04-10 14:14:56 -07:00
gVisor bot 13ff778ec5 Merge pull request #10207 from worrycare:master
PiperOrigin-RevId: 622246120
2024-04-05 12:09:55 -07:00
Kevin Krakauer c9964aa985 netstack: remove GRO from ingress flow
GRO is getting moved and updated. This removes it in preparation for a
follow-up CL.

PiperOrigin-RevId: 621984030
2024-04-04 15:17:08 -07:00
dongjinlong ba02461e12 chore: remove repetitive words in comments
Signed-off-by: dongjinlong <dongjinlong@outlook.com>
2024-03-26 19:57:40 +08:00
Nayana Bidari 568434b397 Enable S/R for all syscall tests.
Enable S/R by default for all syscall tests.

PiperOrigin-RevId: 607116892
2024-02-14 15:05:19 -08:00
Nayana Bidari 38d33704ae Enable S/R for runsc syscall tests.
This CL adds a new "save" variant for runsc syscall tests to enable S/R.
The changes include:
- Adding the syscall trigger to start the S/R in the tests.
- Changes in the test framework to save and restore the sandbox.

PiperOrigin-RevId: 604800992
2024-02-06 16:34:33 -08:00
Andrei Vagin 5b33e4a3d8 Enable leak checkers for runsc tests
Updates #4572

PiperOrigin-RevId: 597307765
2024-01-10 11:30:58 -08:00
Nayana Bidari 58cbc1af95 Modify cgroup tests to make the tests pass with the new behavior.
The cgroups mounting is changed, in the root container cgroups are mounted
by default and for other containers the cgroups are mounted if the spec has a
cgroup mount. These tests mount cgroups directly which will fail. This CL
modifies the cgroup tests to pass with the new behavior.

PiperOrigin-RevId: 596739547
2024-01-08 16:56:25 -08:00
Andrei Vagin b92f900240 tests: change the default platfrom from ptrace to systrap
PiperOrigin-RevId: 578944483
2023-11-02 12:35:46 -07:00
Lucas Manning cd1c1599d6 Add locking to fuse loopback file system handler to appease race detector.
PiperOrigin-RevId: 574540305
2023-10-18 11:35:51 -07:00
Andrei Vagin 485de2f6a7 test/syscalls: run tests in the single thread mode
It allows us to avoid side effects on forking new processes.

PiperOrigin-RevId: 568391853
2023-09-25 19:53:38 -07:00
Lucas Manning ad275a100e 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 Manning 8b9208aaa8 Fix the delay-for-debugger flag so that it reports test failures.
The wait command will always return 0 even if the underlying process
returns a different exit code. It prints out the exit code of the process
to its stdout as json.

PiperOrigin-RevId: 557877257
2023-08-17 11:07:39 -07:00