Commit Graph

2808 Commits

Author SHA1 Message Date
Jamie Liu 257225c34b Downgrade VFS1-specific FIXME to a NOTE.
PiperOrigin-RevId: 305794509
2020-04-09 17:30:51 -07:00
Fabricio Voznika 2a28e3e9c3 Don't unconditionally set --panic-signal
Closes #2393

PiperOrigin-RevId: 305793027
2020-04-09 17:20:14 -07:00
Fabricio Voznika 9f87502b46 Remove TODOs from Async IO
Block and drain requests in io_destroy(2).
Note the reason to create read-only mapping.

PiperOrigin-RevId: 305786312
2020-04-09 16:41:27 -07:00
Ting-Yu Wang ace90f823c Make some functions in IfAddrHelper const.
PiperOrigin-RevId: 305782490
2020-04-09 16:22:02 -07:00
Nicolas Lacasse 5b41f33642 Remove "no-sandbox" tag.
It seems no longer necessary.

PiperOrigin-RevId: 305758572
2020-04-09 14:18:49 -07:00
Nicolas Lacasse 9a5e5ab2fa Bump rule_go, bazel toolchain, and go toolchain versions.
PiperOrigin-RevId: 305751225
2020-04-09 13:42:10 -07:00
Ting-Yu Wang 64c2b49067 Dedup netlink utility functions in tests.
PiperOrigin-RevId: 305749697
2020-04-09 13:34:31 -07:00
Dean Deng 2b4687a46b Handle os.LinkError in p9/handlers.go.
PiperOrigin-RevId: 305721329
2020-04-09 11:17:11 -07:00
Jamie Liu 8f68be7491 Don't use REP string instructions in safecopy.memcpy.
PiperOrigin-RevId: 305718392
2020-04-09 11:03:43 -07:00
Andrei Vagin 7928aa345e Convert int and bool socket options to use GetSockOptInt and GetSockOptBool
PiperOrigin-RevId: 305699233
2020-04-09 09:31:48 -07:00
Andrei Vagin 1ebfdcc86c kokoro: fix handling of apt-get errors
When a command is called as if expression, its error
code can be get only in this if block.

For example, the next script prints 0:

if ( false ); then
  true
fi
echo $?

PiperOrigin-RevId: 305638629
2020-04-09 01:12:27 -07:00
gVisor bot 21e438d257 Dereference pointers in Layer's Stringer impl
Dereference any fields which are pointers before string formatting so that the
value pointed to ends up in the string representation.

Tested:
  Added TestLayerStringFormat to
  //third_party/gvisor/test/packetimpact/testbench:testbench_test
PiperOrigin-RevId: 305627821
2020-04-08 23:30:09 -07:00
Andrei Vagin a10389e783 splice: cap splice calls to MAX_RW_COUNT
The Linux does the same.

Reported-by: syzbot+e81716e8956e92e9d56b@syzkaller.appspotmail.com
PiperOrigin-RevId: 305625439
2020-04-08 23:03:12 -07:00
Jamie Liu 7297fd7238 Bump proc_test's kRSSTolerance to 10MB.
PiperOrigin-RevId: 305604557
2020-04-08 19:41:43 -07:00
Jamie Liu 0f75f7273d Don't call platform.AddressSpace.MapFile with no permissions.
PiperOrigin-RevId: 305598136
2020-04-08 18:42:05 -07:00
Fabricio Voznika 6dd5a1f3fe Clean up TODOs
PiperOrigin-RevId: 305592245
2020-04-08 17:58:13 -07:00
Dean Deng 981a587476 Remove InodeOperations FIXMEs that will be obsoleted by VFS2.
PiperOrigin-RevId: 305588941
2020-04-08 17:34:02 -07:00
Dean Deng 357f136e42 Handle utimes correctly for shared gofer filesystems.
Determine system time from within the sentry rather than relying on the remote
filesystem to prevent inconsistencies.
Resolve related TODOs; the time discrepancies in question don't exist anymore.

PiperOrigin-RevId: 305557099
2020-04-08 14:39:25 -07:00
Ting-Yu Wang 2907e6da5e file test: Remove FIXME about FIFO. It is already tested in mknod test.
PiperOrigin-RevId: 305546584
2020-04-08 13:48:09 -07:00
Jamie Liu d8c0c1d9d5 Do not hold FileDescription references in VFS2 procfs inodes.
FileDescription references are side-effectual; for example, holding a reference
on the write end of a pipe prevents reads from the read end from returning EOF.

This change is consistent with Linux, but not VFS1; while VFS1 also has this
bug, it's less visible there since VFS1 procfs disables caching.

Updates #1195

PiperOrigin-RevId: 305545099
2020-04-08 13:40:27 -07:00
Fabricio Voznika b30130567d Enable SubprocessExited and SubprocessZombie for gVisor
Updates #164

PiperOrigin-RevId: 305544029
2020-04-08 13:34:44 -07:00
Eyal Soha 71c7e24e5c Return all packets when Expect fails.
PiperOrigin-RevId: 305466309
2020-04-08 06:42:58 -07:00
Andrei Vagin c7d841ac6e tests: Specify NoRandomSave for PortReuse tests
SO_REUSEPORT is not properly restored:
https://github.com/google/gvisor/issues/873

PiperOrigin-RevId: 305422775
2020-04-08 00:26:28 -07:00
Ian Lewis 56054fc1fb Add friendlier messages for frequently encountered errors.
Issue #2270
Issue #1765

PiperOrigin-RevId: 305385436
2020-04-07 18:51:01 -07:00
Ian Lewis 5802051b3d Update TODO to #238
Move TODO to #238 so that proper synchronization of operations is handled
when we create the urpc client.

Issue #238
Fixes #512

PiperOrigin-RevId: 305383924
2020-04-07 18:39:33 -07:00
Fabricio Voznika 5a1324625f Make unlink tests pass with goferfs
Required directory checks were being skipped when there was
no child cached. Now the code always loads the child file
before unlinking it.

Updates #1198

PiperOrigin-RevId: 305382323
2020-04-07 18:27:55 -07:00
gVisor bot dbcc59af0b Test TCP sender behavior against window shrinking
RFC 1122 Section 3.7: A sending TCP MUST be robust against window shrinking,
which may cause the "useable window" to become negative.

PiperOrigin-RevId: 305377072
2020-04-07 17:49:21 -07:00
Andrei Vagin acf0259255 Don't map the 0 uid into a sandbox user namespace
Starting with go1.13, we can specify ambient capabilities when we execute a new
process with os/exe.Cmd.

PiperOrigin-RevId: 305366706
2020-04-07 16:46:05 -07:00
Dean Deng 693b6bdda9 Correctly distinguish between seekable and non-seekable host fds.
Check whether an fd is seekable by calling the seek syscall and
examining the return value, instead of checking the file type,
which is inaccurate.

PiperOrigin-RevId: 305361593
2020-04-07 16:17:40 -07:00
Dean Deng fc72eb3595 Remove TODOs for local gofer extended attributes.
PiperOrigin-RevId: 305344989
2020-04-07 14:48:40 -07:00
Ting-Yu Wang d5ddb53650 Remove out-of-date TODOs.
We already have network namespace for netstack.

PiperOrigin-RevId: 305341954
2020-04-07 14:33:48 -07:00
gVisor bot 47db097773 Internal change.
PiperOrigin-RevId: 305341059
2020-04-07 14:29:29 -07:00
Ghanan Gowripalan 6db55a5bd8 Require that IPv6 headers be in the first fragment
Test:
- header_test.TestIPv6ExtHdrIter
- ipv6_test.TestReceiveIPv6Fragments

Updates #2197, #2333

PiperOrigin-RevId: 305330178
2020-04-07 13:37:10 -07:00
Ting-Yu Wang 71770e5662 mkdir test: Address TODOs and re-enable a test.
PiperOrigin-RevId: 305328184
2020-04-07 13:28:33 -07:00
Fabricio Voznika 94319a8241 Make gofer.dentry.destroyLocked idempotent
gofer operations accumulate dentries touched in a slice to call
checkCachingLocked on them when the operation is over. In case
the same dentry is touched multiple times during the operation,
checkCachingLocked, and consequently destroyLocked, may be called
more than once for the same dentry.

Updates #1198

PiperOrigin-RevId: 305276819
2020-04-07 09:41:58 -07:00
Dean Deng 51e461cf9c Add concurrency guarantees to p9 extended attribute methods.
PiperOrigin-RevId: 305171772
2020-04-06 20:08:51 -07:00
Eyal Soha 32fc11ee3e Sort posix service functions
PiperOrigin-RevId: 305157179
2020-04-06 17:53:43 -07:00
Jamie Liu dd98fdd5be Correctly implement magic symlinks in VFS2 procfs.
Updates #1195

PiperOrigin-RevId: 305143567
2020-04-06 16:32:37 -07:00
Nicolas Lacasse f332a864e8 Port timerfd to VFS2.
PiperOrigin-RevId: 305067208
2020-04-06 10:52:56 -07:00
Dean Deng 4baa7e7079 Bump up acceptable sample count for flaky itimer test.
Running the test 1000x almost always produces 1+ test failures where
the sample count is slightly more than 60.

PiperOrigin-RevId: 305051754
2020-04-06 09:51:26 -07:00
Dean Deng 00d9776a4b Add socket files to tmpfs VFS2.
Updates #1476.

PiperOrigin-RevId: 305024274
2020-04-06 07:31:27 -07:00
Eyal Soha 7482902364 Implement Stringer for Layer
Tested:
  Sample output for printing 3 different Layer structs:

  &testbench.Ether{SrcAddr:02:42:c4:77:5d:14 DstAddr:02:42:c4:77:5d:0a}
  &testbench.IPv4{SrcAddr:196.119.93.20 DstAddr:224.0.0.1}
  &testbench.UDP{SrcPort:0xc00033b260 DstPort:0xc00033b280}

  Sample output for printing a Layers struct (word-wrapped):
  [&testbench.Ether{SrcAddr:02:42:c4:77:5d:14 DstAddr:02:42:c4:77:5d:0a}
   &testbench.IPv4{SrcAddr:196.119.93.20 DstAddr:224.0.0.1}
   &testbench.UDP{SrcPort:0xc00033b260 DstPort:0xc00033b280}
   &testbench.Payload{Bytes:[104 101 108 108 111 32 119 111 114 108 100]}]

PiperOrigin-RevId: 305014376
2020-04-06 06:25:24 -07:00
Dean Deng 24bee1c181 Record VFS2 sockets in global socket map.
Updates #1476, #1478, #1484, #1485.

PiperOrigin-RevId: 304845354
2020-04-04 21:02:42 -07:00
Bhasker Hariharan fc99a7ebf0 Refactor software GSO code.
Software GSO implementation currently has a complicated code path with
implicit assumptions that all packets to WritePackets carry same Data
and it does this to avoid allocations on the path etc. But this makes it
hard to reuse the WritePackets API.

This change breaks all such assumptions by introducing a new Vectorised
View API ReadToVV which can be used to cleanly split a VV into multiple
independent VVs. Further this change also makes packet buffers linkable
to form an intrusive list. This allows us to get rid of the array of
packet buffers that are passed in the WritePackets API call and replace
it with a list of packet buffers.

While this code does introduce some more allocations in the benchmarks
it doesn't cause any degradation.

Updates #231

PiperOrigin-RevId: 304731742
2020-04-03 18:35:55 -07:00
Dean Deng 5818663ebe Add FileDescriptionImpl for Unix sockets.
This change involves several steps:
- Refactor the VFS1 unix socket implementation to share methods between VFS1
  and VFS2 where possible. Re-implement the rest.
- Override the default PRead, Read, PWrite, Write, Ioctl, Release methods in
  FileDescriptionDefaultImpl.
- Add functions to create and initialize a new Dentry/Inode and FileDescription
  for a Unix socket file.

Updates #1476

PiperOrigin-RevId: 304689796
2020-04-03 14:08:54 -07:00
Adin Scannell a94309628e Ensure EOF is handled propertly during splice.
PiperOrigin-RevId: 304684417
2020-04-03 13:40:51 -07:00
Andrei Vagin 4032cf06e4 Deflake //third_party/gvisor/test/perf:getdents_benchmark_runsc_ptrace
* Increase a buffer size for getdents64
* Increase a number of shards

PiperOrigin-RevId: 304670004
2020-04-03 12:29:03 -07:00
Tamir Duberstein ea98693d91 Add missing newline
PiperOrigin-RevId: 304659346
2020-04-03 11:38:37 -07:00
gVisor bot 1921c246a9 Internal change.
PiperOrigin-RevId: 304641990
2020-04-03 10:20:55 -07:00
Uros Prestor d151693530 Avoid sending a partial dirent when the Rreaddir response exceeds message limit.
PiperOrigin-RevId: 304542967
2020-04-02 22:03:20 -07:00