Commit Graph

1691 Commits

Author SHA1 Message Date
Bhasker Hariharan 542fbd01a7 Fix race in FDTable.GetFDs().
PiperOrigin-RevId: 258635459
2019-07-17 13:56:49 -07:00
Kevin Krakauer 9f1189130e Add AF_UNIX, SOCK_RAW sockets, which exist for some reason.
tcpdump creates these.

PiperOrigin-RevId: 258611829
2019-07-17 11:49:16 -07:00
gVisor bot 682fd2d68f Merge pull request #533 from kevinGC:stub-dev-tty
PiperOrigin-RevId: 258607547
2019-07-17 11:28:30 -07:00
Michael Pratt ca829158e3 Properly invalidate cache in rename and remove
We were invalidating the wrong overlayEntry in rename and missing invalidation
in rename and remove if lower exists.

PiperOrigin-RevId: 258604685
2019-07-17 11:14:57 -07:00
Adrien Leravat 02d1bd67f0 Add CLOCK_BOOTTIME tests to timerfd.cc 2019-07-16 21:30:48 -07:00
gVisor bot 78a2704bde Merge pull request #474 from zhuangel:proctasks
PiperOrigin-RevId: 258479216
2019-07-16 18:12:07 -07:00
Andrei Vagin 89368456d8 test/integration: wait a background process
Otherwise this process can be killed before it prints the test message.

PiperOrigin-RevId: 258448204
2019-07-16 15:06:17 -07:00
gVisor bot 74dc663bbb Internal change.
PiperOrigin-RevId: 258424489
2019-07-16 13:03:37 -07:00
Jianfeng Tan cf4fc510fd Support /proc/net/dev
This proc file reports the stats of interfaces. We could use ifconfig
command to check the result.

Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com>
Change-Id: Ia7c1e637f5c76c30791ffda68ee61e861b6ef827
COPYBARA_INTEGRATE_REVIEW=https://gvisor-review.googlesource.com/c/gvisor/+/18282/
PiperOrigin-RevId: 258303936
2019-07-15 22:51:05 -07:00
Andrei Vagin 6a8ff6daef kvm: wake up all waiter of vCPU.state
Now we call FUTEX_WAKE with ^uintptr(0) of waiters, but in this case only one
waiter will be waked up. If we want to wake up all of them, the number of
waiters has to be set to math.MaxInt32.

PiperOrigin-RevId: 258285286
2019-07-15 19:27:18 -07:00
Kevin Krakauer 3d78baf06d Replace vector of arrays with array of arrays.
C++ does not like vectors of arrays (because arrays are not copy-constructable).

PiperOrigin-RevId: 258270980
2019-07-15 17:29:13 -07:00
Neel Natu ab44d145bb Fix initialization of badhandler_low_water_mark in SigaltstackTest.
It is now correctly initialized to the top of the signal stack.
Previously it was initialized to the address of 'stack.ss_sp' on
the main thread stack.

PiperOrigin-RevId: 258248363
2019-07-15 15:22:24 -07:00
Kevin Krakauer 9b4d3280e1 Add IPPROTO_RAW, which allows raw sockets to write IP headers.
iptables also relies on IPPROTO_RAW in a way. It opens such a socket to
manipulate the kernel's tables, but it doesn't actually use any of the
functionality. Blegh.

PiperOrigin-RevId: 257903078
2019-07-12 18:09:12 -07:00
Tamir Duberstein 17bab652af Check that IP headers contain correct version
PiperOrigin-RevId: 257888338
2019-07-12 16:19:18 -07:00
gVisor bot c8ae00eb8a Merge pull request #350 from kshithijiyer:patch-1
PiperOrigin-RevId: 257887940
2019-07-12 16:15:51 -07:00
Kevin Krakauer 6ebb925acd Add permission, char device, and uid checks.
Change-Id: I8307bfb390a56424aaa651285a218aad277c4aed
2019-07-12 15:16:01 -07:00
Adin Scannell 4ad6705089 CONTRIBUTING: add logs access instructions.
PiperOrigin-RevId: 257870018
2019-07-12 14:34:33 -07:00
Bhasker Hariharan 6116473b2f Stub out support for TCP_MAXSEG.
Adds support to set/get the TCP_MAXSEG value but does not
really change the segment sizes emitted by netstack or
alter the MSS advertised by the endpoint. This is currently
being added only to unblock iperf3 on gVisor. Plumbing
this correctly requires a bit more work which will come
in separate CLs.

PiperOrigin-RevId: 257859112
2019-07-12 13:35:17 -07:00
Nicolas Lacasse 8f11e257c9 Take a reference on the already-mounted inode before re-mounting it.
PiperOrigin-RevId: 257855777
2019-07-12 13:15:14 -07:00
gVisor bot eff2c264a4 Merge pull request #282 from zhangningdlut:chris_test_proc
PiperOrigin-RevId: 257855479
2019-07-12 13:11:01 -07:00
Nicolas Lacasse 69e0affaec Don't emit an event for extended attribute syscalls.
These are filesystem-specific, and filesystems are allowed to return ENOTSUP if
they are not supported.

PiperOrigin-RevId: 257813477
2019-07-12 09:11:04 -07:00
Matthias Bertschy 239d7c6fdf go_generics: treat the Sel part of an ast.SelectorExpr 2019-07-12 08:09:48 +02:00
Kevin ddef7f8078 Fix license year and remove Read. 2019-07-11 21:31:26 -07:00
Kevin 44427d8e26 Add a stub for /dev/tty.
Actual implementation to follow, but this will satisfy applications that
want it to just exist.
2019-07-11 21:24:27 -07:00
Ayush Ranjan 2eeca68900 Added tiny ext4 image.
The image is of size 64Kb which supports 64 1k blocks
and 16 inodes. This is the smallest size mkfs.ext4 works with.

Added README.md documenting how this was created and included
all files on the device under assets.

PiperOrigin-RevId: 257712672
2019-07-11 17:17:47 -07:00
Nicolas Lacasse 07bb86080f Bump rules_go to v0.18.7 and go toolchain to v1.12.7.
PiperOrigin-RevId: 257703164
2019-07-11 16:20:43 -07:00
Ayush Ranjan 5242face2e ext: boilerplate code.
Renamed ext4 to ext since we are targeting ext(2/3/4).
Removed fs.go since we are targeting VFS2.
Added ext.go with filesystem struct.

PiperOrigin-RevId: 257689775
2019-07-11 15:05:36 -07:00
Andrei Vagin a018b229b5 kokoro: use bazel 2.27.1
The latest version 2.28.0 doesn't work:
./runsc/linux_amd64_pure_stripped/runsc: operation not permitted, want 0

PiperOrigin-RevId: 257663312
2019-07-11 12:53:19 -07:00
Liu Hua 7581e84cb6 tss: block userspace access to all I/O ports.
A userspace process (CPL=3) can access an i/o port if the bit corresponding to
the port is set to 0 in the I/O permission bitmap.

Configure the I/O permission bitmap address beyond the last valid byte in the
TSS so access to all i/o ports is blocked.

Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Change-Id: I3df76980c3735491db768f7210e71703f86bb989
PiperOrigin-RevId: 257336518
2019-07-09 22:21:56 -07:00
Ayush Ranjan 7965b1272b ext4: disklayout: Directory Entry implementation.
PiperOrigin-RevId: 257314911
2019-07-09 18:36:02 -07:00
Adin Scannell dea3cb92f2 build: add nogo for static validation
PiperOrigin-RevId: 257297820
2019-07-09 16:44:06 -07:00
Adin Scannell cceef9d2cf Cleanup straggling syscall dependencies.
PiperOrigin-RevId: 257293198
2019-07-09 16:18:02 -07:00
Nicolas Lacasse 6db3f8d54c Don't mask errors in createAt loop.
The error set in the loop in createAt was being masked
by other errors declared with ":=". This allowed an
ErrResolveViaReadlink error to escape, which can cause
a sentry panic.

Added test case which repros without the fix.

PiperOrigin-RevId: 257061767
2019-07-08 14:57:15 -07:00
gVisor bot e45d724948 Internal change.
PiperOrigin-RevId: 257042681
2019-07-08 13:54:58 -07:00
gVisor bot c2cebbc8da Merge pull request #375 from jmgao:master
PiperOrigin-RevId: 257041876
2019-07-08 13:51:09 -07:00
Nicolas Lacasse 659bebab8e Don't try to execute a file that is not regular.
PiperOrigin-RevId: 257037608
2019-07-08 12:56:48 -07:00
Ayush Ranjan 8f9b1ca8e7 ext4: disklayout: inode impl.
PiperOrigin-RevId: 257010414
2019-07-08 10:44:11 -07:00
Andrei Vagin 67f2cefce0 Avoid importing platforms from many source files
PiperOrigin-RevId: 256494243
2019-07-03 22:51:26 -07:00
Ian Lewis da57fb9d25 Fix syscall doc for getresgid
PiperOrigin-RevId: 256481284
2019-07-03 20:13:19 -07:00
Neel Natu 9f2f9f0cab futex: compare keys for equality when doing a FUTEX_UNLOCK_PI.
PiperOrigin-RevId: 256453827
2019-07-03 16:01:38 -07:00
Andrei Vagin 116cac053e netstack/udp: connect with the AF_UNSPEC address family means disconnect
PiperOrigin-RevId: 256433283
2019-07-03 14:19:02 -07:00
gVisor bot f10862696c Merge pull request #493 from ahmetb:reticulating-splines
PiperOrigin-RevId: 256319059
2019-07-03 01:10:34 -07:00
Yong He 85b27a9f8f Solve BounceToKernel may hang issue
BounceToKernel will make vCPU quit from guest ring3 to guest ring0, but
vCPUWaiter is not cleared when we unlock the vCPU, when next time this vCPU
enter guest mode ring3, vCPU may enter guest mode with vCPUWaiter bit setted,
this will cause the following BounceToKernel to this vCPU hangs at
waitUntilNot.

Halt may workaroud this issue, because halt process will reset vCPU status into
vCPUUser, and notify all waiter for vCPU state change, but if there is no
exception or syscall in this period, BounceToKernel will hang at waitUntilNot.

PiperOrigin-RevId: 256299660
2019-07-02 22:03:28 -07:00
Adin Scannell 753da9604e Remove map from fd_map, change to fd_table.
This renames FDMap to FDTable and drops the kernel.FD type, which had an entire
package to itself and didn't serve much use (it was freely cast between types,
and served as more of an annoyance than providing any protection.)

Based on BenchmarkFDLookupAndDecRef-12, we can expect 5-10 ns per lookup
operation, and 10-15 ns per concurrent lookup operation of savings.

This also fixes two tangential usage issues with the FDMap. Namely, non-atomic
use of NewFDFrom and associated calls to Remove (that are both racy and fail to
drop the reference on the underlying file.)

PiperOrigin-RevId: 256285890
2019-07-02 19:28:59 -07:00
Ian Lewis 3f14caeb99 Add documentation for remaining syscalls (fixes #197, #186)
Adds support level documentation for all syscalls. Removes the Undocumented
utility function to discourage usage while leaving SupportUndocumented as the
default support level for Syscall structs.

PiperOrigin-RevId: 256281927
2019-07-02 18:45:16 -07:00
Neel Natu 1178a278ae Mark timers_test flaky because setrlimit(RLIMIT_CPU) is broken in some kernels.
https://bugzilla.redhat.com/show_bug.cgi?id=1568337

PiperOrigin-RevId: 256276198
2019-07-02 17:58:15 -07:00
Ayush Ranjan d8ec2fb671 Ext4: DiskLayout: Inode interface.
PiperOrigin-RevId: 256234390
2019-07-02 14:04:31 -07:00
gVisor bot d60ae0ddee Merge pull request #279 from kevinGC:iptables-1-pkg
PiperOrigin-RevId: 256231055
2019-07-02 13:48:06 -07:00
Nicolas Lacasse 4f2f44320f Simplify (and fix) refcounts in createAt.
fileOpAt holds references on the Dirents passed as arguments to the callback,
and drops refs when finished, so we don't need to DecRef those Dirents
ourselves

However, all Dirents that we get from FindInode/FindLink must be DecRef'd.

This CL cleans up the ref-counting logic, and fixes some refcount issues in the
process.

PiperOrigin-RevId: 256220882
2019-07-02 12:58:58 -07:00
Ahmet Alp Balkan 4cd28c6e27
sentry/kernel: add syslog message
It feels like "reticulating splines" is missing from the list of meaningless
syslog messages.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-07-02 12:05:41 -07:00