Commit Graph
87 Commits
Author SHA1 Message Date
Mithun IyerandgVisor bot c675d535d2 Skip EventHUp notify in FIN_WAIT2 on a socket close.
This Notify was added as part of cl/279106406; but notifying `EventHUp`
in `FIN_WAIT2` is incorrect, as we want to only notify later on
`TIME_WAIT` or a reset. However, we do need to notify any blocked
waiters of an activity on the endpoint with `EventIn`|`EventOut`.

PiperOrigin-RevId: 341490913
2020-11-09 14:54:57 -08:00
Nicolas LacasseandgVisor bot 15f268b4f0 Fix infinite loop when splicing to pipes/eventfds.
Writes to pipes of size < PIPE_BUF are guaranteed to be atomic, so writes
larger than that will return EAGAIN if the pipe has capacity < PIPE_BUF.

Writes to eventfds will return EAGAIN if the write would cause the eventfd
value to go over the max.

In both such cases, calling Ready() on the FD will return true (because it is
possible to write), but specific kinds of writes will in fact return EAGAIN.

This CL fixes an infinite loop in splice and sendfile (VFS1 and VFS2) by
forcing skipping the readiness check for the outfile in send, splice, and tee.

PiperOrigin-RevId: 341102260
2020-11-06 12:55:29 -08:00
gVisor bot 584dd45b6d Merge pull request #4543 from lubinszARM:pr_test_sigaltstack
PiperOrigin-RevId: 339459247
2020-10-28 08:00:34 -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
Bin Lu 2223b55c07 arm64 test: enabled Fault() function
Currently, this Fault() function does not work properly on the arm platform.

After modification, sigaltstack_test_runsc_kvm can be passed on
Arm64.

Signed-off-by: Bin Lu <[email protected]>
2020-10-22 06:00:33 -04:00
Dean DengandgVisor bot 0e2c0bf7dc Use POSIX interval timers in flock test.
ualarm(2) is obsolete. Move IntervalTimer into a test util, where it can be
used by flock tests.

These tests were flaky with TSAN, probably because it slowed the tests down
enough that the alarm was expiring before flock() was called. Use an interval
timer so that even if we miss the first alarm (or more), flock() is still
guaranteed to be interrupted.

PiperOrigin-RevId: 337578751
2020-10-16 14:32:49 -07:00
gVisor bot 835c08c4d1 Internal change.
PiperOrigin-RevId: 335429072
2020-10-05 13:17:19 -07:00
Andrei VaginandAndrei Vagin eea7979844 test/fuse: clean up 2020-09-16 12:22:17 -07:00
Craig ChiandAndrei Vagin 9a758a8846 Add fh support for revise attr and fstat(2) test
According to Linux 4.4's FUSE behavior, the flags and fh attributes in
FUSE_GETATTR are only used in read, write, and lseek. fstat(2) doesn't
use them either. Add tests to ensure the requests sent from FUSE module
are consistent with Linux's.

Updates #3655
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 571a451c4e Add default attr in fuse_util
fuse_util provides utilities for fuse testing. Add a function to return
a stub fuse_attr struct with specified mode and nodeid.
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin fa559f2361 Implement FUSE_OPEN/OPENDIR
Fixes #3174
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 56937e782e Add function generating array of iovec with different FUSE structs
This commit adds a function in the newly created fuse_util library,
which accepts a variable number of arguments and data structures.

Fixes #3609
2020-09-16 12:19:30 -07:00
Ayush RanjanandgVisor bot c0fc119a08 [vfs] Disable nlink tests for overlayfs.
Overlayfs intentionally does not compute nlink for directories (because it can
be really expensive). Linux returns 1, VFS2 returns 2 and VFS1 actually
calculates the correct value.

PiperOrigin-RevId: 330967139
2020-09-10 10:40:35 -07:00
Ayush RanjanandgVisor bot 10c84f454e Refactor tty codebase to use master-replica terminology.
Updates #2972

PiperOrigin-RevId: 329584905
2020-09-01 14:43:41 -07:00
Tamir DubersteinandgVisor bot 63c7c97b2e Remove __fuchsia__ defines
These mostly guard linux-only headers; check for linux instead.

PiperOrigin-RevId: 329362762
2020-08-31 13:10:56 -07:00
Zach KoopmansandgVisor bot 9cf43b31d6 Fix JobControl tests for open source.
ioctl calls with TIOCSCTTY fail if the calling process already has a
controlling terminal, which occurs on a 5.4 kernel like our Ubuntu 18 CI.
Thus, run tests calling ioctl TTOCSCTTY in clean subprocess.

Also, while we're here, switch out non-inclusive master/slave for main/replica.

PiperOrigin-RevId: 328756598
2020-08-27 09:52:49 -07:00
Nicolas LacasseandgVisor bot 8f1b4fae1a tmpfs: Allow xattrs in the trusted namespace if creds has CAP_SYS_ADMIN.
This is needed to support the overlay opaque attribute.

PiperOrigin-RevId: 328552985
2020-08-26 10:05:34 -07:00
gVisor bot 568bf40c32 Merge pull request #3165 from ridwanmsharif:ridwanmsharif/fuse-off-by-default
PiperOrigin-RevId: 321411758
2020-07-15 12:14:42 -07:00
Fabricio VoznikaandgVisor bot a3f00b9b98 Add ReadAllFd to test util
PiperOrigin-RevId: 321008185
2020-07-13 12:23:18 -07:00
Ridwan Sharif 0ac05e2793 Gate FUSE behind a runsc flag
This change gates all FUSE commands (by gating /dev/fuse) behind a runsc
flag. In order to use FUSE commands, use the --fuse flag with the --vfs2
flag. Check if FUSE is enabled by running dmesg in the sandbox.
2020-07-09 02:01:29 -04:00
Jamie LiuandgVisor bot a219f8cc4e Deflake exec test.
- Only use MAXSYMLINKS/2+1 symlinks for each of the interpreter and script
  paths in SymlinkLimitRefreshedForInterpreter to tolerate cases where the
  original paths (/tmp, /bin, or /bin/echo) themselves contain symlinks.

- Ensure that UnshareFiles performs execve immediately after clone(CLONE_VFORK)
  (no heap allocation for ExecveArray/RunfilesPath).

- Use lstat() rather than stat() for the existence check in fs_util's Exists;
  the latter will fail if the symlink target does not exist, even if the
  symlink does.

PiperOrigin-RevId: 320110156
2020-07-07 19:45:16 -07:00
Jay ZhuangandgVisor bot 3494ac8f54 Add test env variable "fuchsia"
... so that Fuchsia gets the same special cases applied to gVisor in tests when
this envrionment variable is set.

PiperOrigin-RevId: 319239064
2020-07-01 09:36:07 -07:00
Dean DengandgVisor bot a5fa52fbfd Fix vfs2 tmpfs link permission checks.
Updates #2923.

PiperOrigin-RevId: 317246916
2020-06-18 22:02:07 -07:00
Fabricio VoznikaandgVisor bot a8879289ee Add IsRunningWithVFS1 to test util
VFS2 is adding more functionality than VFS1. In order to test
new functionality, it's required to skip some tests with VFS1.
To skip tests, use:

SKIP_IF(IsRunningWithVFS1());

The test will run in Linux and gVisor with VFS2 enabled.

Updates #1035

PiperOrigin-RevId: 312698616
2020-05-21 10:48:25 -07:00
Tamir DubersteinandgVisor bot e7187dfbfc Add missing newline
PiperOrigin-RevId: 304659346
2020-04-03 11:38:37 -07:00
Adin ScannellandgVisor bot 877d123395 Move temp_umask to test/util.
PiperOrigin-RevId: 298667595
2020-03-03 12:38:00 -08:00
Adin ScannellandCopybara-Service 412a92112f Add basic microbenchmarks.
PiperOrigin-RevId: 296104390
2020-02-19 18:21:54 -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
Ting-Yu WangandgVisor bot 7effefb84b KVM platform does not support 32bit.
Fixes: //test/syscalls:32bit_test_runsc_kvm
Ref change: ae8ba25bd4
PiperOrigin-RevId: 292563926
2020-01-31 10:07:45 -08:00
Adin ScannellandgVisor bot 4edaa558ec Simplify testing link rules.
PiperOrigin-RevId: 292458933
2020-01-30 17:49:17 -08:00
gVisor bot 2667449240 Merge pull request #1471 from xiaobo55x:syscall_test
PiperOrigin-RevId: 292445329
2020-01-30 16:12:25 -08:00
gVisor bot b9910ad74f Merge pull request #1630 from xiaobo55x:kOLargeFile
PiperOrigin-RevId: 292419699
2020-01-30 14:03:22 -08:00
Michael PrattandgVisor bot 6ae2325bed Prefer Type& over Type &
And Type* over Type *. This is basically a whitespace only change.

gVisor code already prefers left-alignment of pointers and references, but
clang-format formats for consistency with the majority of a file, and some
files leaned the wrong way. This is a one-time pass to make us completely
conforming.

Autogenerated with:

$ find . \( -name "*.cc" -or -name "*.c" -or -name "*.h" \) \
    | xargs clang-format -i -style="{BasedOnStyle: Google,  \
        DerivePointerAlignment: false, PointerAlignment: Left}"

PiperOrigin-RevId: 291972421
2020-01-28 11:18:17 -08:00
Adin ScannellandgVisor bot ae8ba25bd4 Create platform_util for tests.
PiperOrigin-RevId: 291869423
2020-01-27 22:28:43 -08:00
Adin ScannellandgVisor bot 5f66bbfd5a Fix header ordering and format all C++ code.
PiperOrigin-RevId: 291844200
2020-01-27 18:27:20 -08:00
Adin ScannellandgVisor bot 5cd5c2536a Standardize on tools directory.
PiperOrigin-RevId: 291745021
2020-01-27 12:21:00 -08:00
Haibo Xu 3718b509ea Unify the kOLargeFile definition in syscall tests.
Signed-off-by: Haibo Xu <[email protected]>
Change-Id: Id9d6ae98305a4057d55d622ea4c3ac2228fea212
2020-01-23 01:04:02 +00:00
Adin ScannellandgVisor bot 1b8ff2ce79 Change to standard types.
PiperOrigin-RevId: 290846481
2020-01-21 17:28:57 -08:00
gVisor bot 33f3ef287f Merge pull request #1492 from majek:err_typo_in_netstack_tests
PiperOrigin-RevId: 290840370
2020-01-21 16:32:49 -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
Bin Lu 2c7df3196e Add test/util/save_util_linux.cc:MaybeSave to support arm64
There is no syscall_create_module on Arm64.

Signed-off-by: Bin Lu <[email protected]>
2019-12-30 10:09:48 +08:00
Dean DengandgVisor bot 2cdc3dddaa Do not consider symlinks as directories in fs utils.
IsDirectory() is used in RecursivelyDelete(), which should not follow symlinks.
The only other use (syscalls/linux/rename.cc) is not affected by this change.

Updates #1366.

PiperOrigin-RevId: 284803968
2019-12-10 11:09:44 -08:00
Dean DengandgVisor bot f6c6c1bbe3 Allow syscall tests to run with hostinet.
Fixes #1207

PiperOrigin-RevId: 283914438
2019-12-04 23:45:49 -08:00
Michael PrattandgVisor bot f316c04a08 Add RunfilesPath to test_util
A few tests have their own ad-hoc implementations. Add a single common one.

PiperOrigin-RevId: 283601666
2019-12-03 12:47:03 -08:00
Adin ScannellandgVisor bot 3b8d99f217 Import and structure cleanup.
PiperOrigin-RevId: 281795269
2019-11-21 11:41:30 -08:00
Kevin KrakauerandgVisor bot 57c6ef47a4 Check that a file is a regular file with open(O_TRUNC).
It was possible to panic the sentry by opening a cache revalidating folder with
O_TRUNC|O_CREAT.

Avoids breaking php tests.

PiperOrigin-RevId: 280533213
2019-11-14 16:08:34 -08:00
Jay ZhuangandgVisor bot a04c62464c Extract linux-specific test setup to separate file
PiperOrigin-RevId: 280264564
2019-11-13 13:21:50 -08:00
Dean DengandgVisor bot 58b388cf20 Handle AT_EMPTY_PATH flag in execveat.
PiperOrigin-RevId: 276419967
2019-10-23 22:23:05 -07:00
Dean DengandgVisor bot f4c2e78cee Add basic implementation of execveat syscall and associated tests.
Allow file descriptors of directories as well as AT_FDCWD.

PiperOrigin-RevId: 275929668
2019-10-21 14:55:18 -07:00
Andrei VaginandgVisor bot b3651b984a test/perf: optimize the getdents test
* Use mknod instead of open&close to create an empty file.
* Limit a number of files to (1<<16) instead of 100K.

In this case, a test set is (1, 8, 64, 512, 4K, 32K, 64K) instead of (1, 8, 64,
512, 4K, 32K, 98K). I think it is easier to compare results for 32K and 64K
than 32K and 98K. And results for 98K doesn't give us more information than for
54K.

PiperOrigin-RevId: 275552507
2019-10-18 15:01:40 -07:00