Commit Graph

5925 Commits

Author SHA1 Message Date
Adin Scannell 6bcacb2fd1 Support anonymous structs in checklocks.
Fixes #6558

PiperOrigin-RevId: 396393293
2021-09-13 10:54:24 -07:00
gVisor bot 63b1c736b3 Internal change.
PiperOrigin-RevId: 396155387
2021-09-11 18:04:15 -07:00
Etienne Perot 28853599c4 Typo fix.
PiperOrigin-RevId: 396042572
2021-09-10 17:53:52 -07:00
Rahat Mahmood 7da9bb18c2 Use accessor for runsc ControlConfig proto.
PiperOrigin-RevId: 395859347
2021-09-09 22:57:50 -07:00
Ghanan Gowripalan 2572af3886 Remove linux-compat loopback hacks from packet endpoint
Previously, gVisor did not represent loopback devices as an ethernet
device as Linux does. To maintain Linux API compatibility for packet
sockets, a workaround was used to add an ethernet header if a link
header was not already present in the packet buffer delivered to a
packet endpoint.

However, this workaround is a bug for non-ethernet based interfaces; not
all links use an ethernet header (e.g. pure L3/TUN interfaces).

As of 3b4bb94751, gVisor represents
loopback devices as an ethernet-based device so this workaround can
now be removed.

BUG: https://fxbug.dev/81592
Updates #6530, #6531.
PiperOrigin-RevId: 395819151
2021-09-09 17:10:17 -07:00
Jamie Liu 833d933afd Internal change.
PiperOrigin-RevId: 395809193
2021-09-09 16:17:51 -07:00
Ghanan Gowripalan 2d9b33c0fd Remove link/packetsocket
This change removes NetworkDispatcher.DeliverOutboundPacket.

Since all packet writes go through the NIC (the only NetworkDispatcher),
we can deliver outgoing packets to interested packet endpoints before
writing the packet to the link endpoint as the stack expects that all
packets that get delivered to a link endpoint are transmitted on the
wire. That is, link endpoints no longer need to let the stack know when
it writes a packet as the stack already knows about the packet it writes
through a link endpoint.

PiperOrigin-RevId: 395761629
2021-09-09 12:34:54 -07:00
Bhasker Hariharan 5e9c3a0b93 Add EthernetHeader only if underlying NIC has a mac address.
Fixes #6532

PiperOrigin-RevId: 395741741
2021-09-09 11:07:01 -07:00
Rahat Mahmood e90ecdb488 Stub some memory control files.
PiperOrigin-RevId: 395338926
2021-09-07 15:09:09 -07:00
Kevin Lindkvist 2f2fb3813f Conditionally use GetAbsoluteTestTmpdir() rather than hard-code "/tmp"
NewTempAbsPathInDir("/tmp") prevents the generated socket address from
exceeding sizeof(addr.sun_path). However, existing systems that are built with
the ANDROID configuration have their temp directory in a different location.
This change allows those systems to run tests that depend on UniqueUnixAddr.

PiperOrigin-RevId: 395336483
2021-09-07 14:58:39 -07:00
Arthur Sfez dfc518005b Remove protocolMainLoop unused return value
PiperOrigin-RevId: 395325998
2021-09-07 14:09:00 -07:00
Jamie Liu 775a321120 Add //pkg/sentry/seccheck.
This defines common infrastructure for dynamically-configured security checks,
including an example usage in the clone(2) path.

PiperOrigin-RevId: 394797270
2021-09-03 19:12:54 -07:00
Jamie Liu 2aeab259c4 Internal change.
PiperOrigin-RevId: 394560866
2021-09-02 15:50:49 -07:00
Andrei Vagin 9149b2cefd unix: avoid taking two endpoint locks
If we want to take two endpoint locks, we need to be sure that we always
take them in the same order.

Accept() locks the listening endpoint to work with acceptedChan and then
it calls GetLocalAddress that locks an accepted endpoint. Actually, we
can release the listening endpoint lock before calling GetLocalAddress.

Reported-by: syzbot+f52bd603f51a4ae91054@syzkaller.appspotmail.com
PiperOrigin-RevId: 394553823
2021-09-02 15:15:45 -07:00
gVisor bot bd75e52ad8 Merge pull request #6516 from slowy07:minor-changes
PiperOrigin-RevId: 394481127
2021-09-02 09:43:30 -07:00
Ghanan Gowripalan dfb3273f88 Support sending with packet sockets
...through the loopback interface, only.

This change only supports sending on packet sockets through the loopback
interface as the loopback interface is the only interface used in packet
socket syscall tests - the other link endpoints are not excercised with
the existing test infrastructure.

Support for sending on packet sockets through the other interfaces will
be added as needed.

BUG: https://fxbug.dev/81592
PiperOrigin-RevId: 394368899
2021-09-01 19:44:22 -07:00
Bhasker Hariharan 2d3919532a Out-of-order segment should not block in-sequence segments.
For a small receive buffer the first out-of-order segment will get accepted and
fill up the receive buffer today. This change now includes the size of the
out-of-order segment when checking whether to queue the out of order segment or
not.

PiperOrigin-RevId: 394351309
2021-09-01 17:33:49 -07:00
Ghanan Gowripalan ae3bd32011 Extract network datagram endpoint common facilities
...from the UDP endpoint.

Datagram-based transport endpoints (e.g. UDP, RAW IP) can share a lot
of their write path due to the datagram-based nature of these endpoints.
Extract the common facilities from UDP so they can be shared with other
transport endpoints (in a later change).

Test: UDP syscall tests.
PiperOrigin-RevId: 394347774
2021-09-01 17:12:24 -07:00
Chong Cai 5032f4f57d Add ioctl stub constants
PiperOrigin-RevId: 394331928
2021-09-01 15:51:10 -07:00
Jamie Liu b4de26d6b1 Don't use reflection in fpu.alignedBytes.
reflect.ValueOf takes an interface{}, so when passed a slice the compiler emits
a call to runtime.convTslice to heap-allocate a copy of the slice header.

PiperOrigin-RevId: 394310052
2021-09-01 14:07:57 -07:00
Jamie Liu 702fe7d60d Cache vdso.so's __kernel_rt_sigreturn location.
PiperOrigin-RevId: 394300607
2021-09-01 13:25:35 -07:00
Jamie Liu 5da4270a88 Propagate vfs.MkdirOptions.ForSyntheticMountpoint to overlay copy-up.
PiperOrigin-RevId: 394296687
2021-09-01 13:09:00 -07:00
Andrei Vagin 927ea16dd3 unix: handle a case when a buffer is overflowed
Reported-by: syzbot+1aab6800bd14829609b8@syzkaller.appspotmail.com
PiperOrigin-RevId: 394279838
2021-09-01 11:48:23 -07:00
Nayana Bidari 5e3a518915 gVisor rack blog
A blog about RACK loss detection algorithm implemented in gVisor.
(https://datatracker.ietf.org/doc/rfc8985/)

PiperOrigin-RevId: 394265634
2021-09-01 10:46:27 -07:00
Jamie Liu 810ea09575 Cache cpuid.HostFeatureSet().
PiperOrigin-RevId: 394261815
2021-09-01 10:29:51 -07:00
Jamie Liu c5cc6a6566 Remove splice-to/from-weird-files tests.
These tests are permanently broken on Linux after 36e2c7421f02 "fs: don't allow
splice read/write without explicit ops".

PiperOrigin-RevId: 394161079
2021-08-31 23:12:24 -07:00
gVisor bot 976ac9710f Automated rollback of changelist 390405182
PiperOrigin-RevId: 394004809
2021-08-31 08:20:16 -07:00
Zach Koopmans dfbcb8903a [syserr] Fix SIGBUS on syserr.FromError
Fix syzcaller panic SIGBUS on error handling. Done by
adding an interface, errors.GuestError, which errors can
implement in order to be compared against each other.

PiperOrigin-RevId: 393867554
2021-08-30 15:35:02 -07:00
Jamie Liu a247e227b1 Narrow COW-break on thread stacks.
PiperOrigin-RevId: 393841270
2021-08-30 13:28:04 -07:00
Jamie Liu 574c6542a5 Use specialFileFD handles in specialFileFD.Stat().
PiperOrigin-RevId: 393831108
2021-08-30 12:40:08 -07:00
Zeling Feng 9625071e6d Avoid pseudo endpoint for TSVal generation
PiperOrigin-RevId: 393808461
2021-08-30 10:59:45 -07:00
gVisor bot cf65f9a8de Internal change.
PiperOrigin-RevId: 393783192
2021-08-30 09:07:51 -07:00
Nicolas Lacasse f7281c6cb9 Fix lock order violations: mm.mappingMu > Task.mu.
Document this ordering in mm/mm.go.

PiperOrigin-RevId: 393413203
2021-08-27 13:18:49 -07:00
gVisor bot 0db19ea910 Merge pull request #6415 from ZachEddy:containerd-runtime-options-v1.5
PiperOrigin-RevId: 393411409
2021-08-27 13:08:21 -07:00
Ghanan Gowripalan fbf020d6a0 Add LinkEndpoint.WriteRawPacket with stubs
...returning unsupported errors.

PiperOrigin-RevId: 393388991
2021-08-27 11:15:23 -07:00
slowy07 3bf5ff8941 fix: revert go.mod 2021-08-27 08:42:05 +07:00
slowy07 fb113bb108 fix: typo spelling grammar 2021-08-27 07:45:16 +07:00
Zeling Feng 1076702371 Add Stack.Seed() back
... because it is still used by fuchsia.

PiperOrigin-RevId: 393246904
2021-08-26 17:44:25 -07:00
gVisor bot a69f8c8d59 Merge pull request #6509 from gystemd:fix_test_pty_5357
PiperOrigin-RevId: 393217676
2021-08-26 15:15:34 -07:00
Tamir Duberstein ec46befd10 Centralize TCP timestamp logic
Remove freestanding functions that convert time values to raw integers;
centralize time->uint32 logic in methods on tcp.endpoint. Importantly,
the knowledge that TSVal is in milliseconds now lives in adjacent
functions rather than being spread around various files.

Incidental cleanup:
- Remove unused constant
- Remove redundant conversion
- Remove redundant parentheses
- Add missing error check

PiperOrigin-RevId: 393184768
2021-08-26 12:45:38 -07:00
gystemd 73ba5943cf fix tests in pty.cc
fixed and enabled SetForegroundProcessGroup and SetForegroundProcessGroupEmptyProcessGroup.
2021-08-26 17:00:10 +02:00
Tamir Duberstein 9f3fa7635e Avoid unhandled error warnings
PiperOrigin-RevId: 393104589
2021-08-26 05:55:43 -07:00
Tamir Duberstein c408789ed4 Remove unused argument
PiperOrigin-RevId: 393100095
2021-08-26 05:16:34 -07:00
Tamir Duberstein 19056957eb Pass must-not-be-nil by value
PiperOrigin-RevId: 393095246
2021-08-26 04:37:28 -07:00
Zeling Feng 4c7aaa941e Improve TestTimestampSynCookies
.. by advancing the clock so that NowMonotonic does not return 0.

PiperOrigin-RevId: 393005373
2021-08-25 16:41:48 -07:00
Tamir Duberstein aa2d07442c Avoid the appearance of allocation
PiperOrigin-RevId: 393004533
2021-08-25 16:32:00 -07:00
Chong Cai c1d656c8e4 Remove quotedev device
PiperOrigin-RevId: 392982220
2021-08-25 14:39:21 -07:00
Zach Koopmans 3fd00bc09b [bm-dashboard] Add debugging to guitar benchmarks.
Add logs to big query for benchmarks. This is to debug the actual
sent data from BQ so it can be compared to the data produced by
the benchmark run.

Current logs end with "Sending benchmarks", which is ambiguous.
Log success to make sure they are sent.

PiperOrigin-RevId: 392944104
2021-08-25 11:44:07 -07:00
gVisor bot 18beb67703 Merge pull request #6438 from gystemd:tcsetpgrp_SIGTTOU
PiperOrigin-RevId: 392774712
2021-08-24 16:43:51 -07:00
Zeling Feng 0c2b2dc752 Measure RTT during handshake since Linux does the same
Some tcp unit tests are affected by this change:
- Some retransmission tests assumed RTO=1s when connection is established. This
  is no longer true because minRTO was set to 3s in tests so now RTO becomes 3s
  after the first updateRTO call. Set minRTO=1s for these tests.
- Some RACK enabled tests are affected because now that RTT is initialized, and
  the estimated RTT is quite small, spurious TLP might be sent out and causing
  flakes, introduce an artificial delay for these tests so that the estimated
  RTT is larger.

PiperOrigin-RevId: 392768725
2021-08-24 16:10:16 -07:00