Commit Graph

1461 Commits

Author SHA1 Message Date
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
Ian Gudger 0aa9418a77 Fix unix/transport.queue reference leaks.
Fix two leaks for connectionless Unix sockets:
* Double connect: Subsequent connects would leak a reference on the previously
  connected endpoint.
* Close unconnected: Sockets which were not connected at the time of closure
  would leak a reference on their receiver.

PiperOrigin-RevId: 256070451
2019-07-01 17:46:24 -07:00
Nicolas Lacasse 4a72c8078e Use new location of python-hello image in tests.
PiperOrigin-RevId: 256062988
2019-07-01 17:01:17 -07:00
Nicolas Lacasse 06537129a6 Check remaining traversal limit when creating a file through a symlink.
This fixes the case when an app tries to create a file that already exists, and
is a symlink to itself. A test was added.

PiperOrigin-RevId: 256044811
2019-07-01 15:25:22 -07:00
Ian Gudger 3446f4e29b Add stack trace printing to reference leak checking.
PiperOrigin-RevId: 255759891
2019-06-29 09:23:22 -07:00
Adin Scannell 6d204f6a34 Drop local_server support.
PiperOrigin-RevId: 255713414
2019-06-28 20:35:10 -07:00
Ian Gudger 45566fa4e4 Add finalizer on AtomicRefCount to check for leaks.
PiperOrigin-RevId: 255711454
2019-06-28 20:07:52 -07:00
Adin Scannell 7dae043fec Drop ashmem and binder.
These are unfortunately unused and unmaintained. They can be brought back in
the future if need requires it.

PiperOrigin-RevId: 255697132
2019-06-28 17:20:25 -07:00
Nicolas Lacasse d3f97aec49 Remove events from name_to_handle_at and open_by_handle_at.
These syscalls require filesystem support that gVisor does not provide, and is
not planning to implement. Their absense should not trigger an event.

PiperOrigin-RevId: 255692871
2019-06-28 16:50:24 -07:00
Ayush Ranjan c4da599e22 ext4: disklayout: SuperBlock interface implementations.
PiperOrigin-RevId: 255687771
2019-06-28 16:18:29 -07:00
Nicolas Lacasse cf51e77d6d Fix suggestions from clang.
PiperOrigin-RevId: 255679603
2019-06-28 15:32:29 -07:00
Nicolas Lacasse 295078fa7a Automated rollback of changelist 255263686
PiperOrigin-RevId: 255679453
2019-06-28 15:28:41 -07:00
Andrei Vagin e21d49c2d8 platform/ptrace: return more detailed errors
Right now, if we can't create a stub process, we will see this error:
panic: unable to activate mm: resource temporarily unavailable

It would be better to know the root cause of this "resource temporarily
unavailable".

PiperOrigin-RevId: 255656831
2019-06-28 13:23:36 -07:00
Ayush Ranjan 7c13789818 Superblock interface in the disk layout package for ext4.
PiperOrigin-RevId: 255644277
2019-06-28 12:07:28 -07:00
Andrei Vagin 8a625ceeb1 runsc: allow openat for runsc-race
I see that runsc-race is killed by SIGSYS, because openat isn't
allowed by seccomp filters:
60052 openat(AT_FDCWD, "/proc/sys/vm/overcommit_memory",
			O_RDONLY|O_CLOEXEC <unfinished ...>
60052 <... openat resumed> )            = 257
60052 --- SIGSYS {si_signo=SIGSYS, si_code=SYS_SECCOMP, si_call_addr=0xfaacf1,
		si_syscall=__NR_openat, si_arch=AUDIT_ARCH_X86_64} ---

PiperOrigin-RevId: 255640808
2019-06-28 11:49:45 -07:00
Fabricio Voznika b2907595e5 Complete pipe support on overlayfs
Get/Set pipe size and ioctl support were missing from
overlayfs. It required moving the pipe.Sizer interface
to fs so that overlay could get access.

Fixes #318

PiperOrigin-RevId: 255511125
2019-06-27 17:22:53 -07:00
Michael Pratt 5b41ba5d0e Fix various spelling issues in the documentation
Addresses obvious typos, in the documentation only.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/443 from Pixep:fix/documentation-spelling 4d0688164eafaf0b3010e5f4824b35d1e7176d65
PiperOrigin-RevId: 255477779
2019-06-27 14:25:50 -07:00
Michael Pratt 085a907565 Cache directory entries in the overlay
Currently, the overlay dirCache is only used for a single logical use of
getdents. i.e., it is discard when the FD is closed or seeked back to
the beginning.

But the initial work of getting the directory contents can be quite
expensive (particularly sorting large directories), so we should keep it
as long as possible.

This is very similar to the readdirCache in fs/gofer.

Since the upper filesystem does not have to allow caching readdir
entries, the new CacheReaddir MountSourceOperations method controls this
behavior.

This caching should be trivially movable to all Inodes if desired,
though that adds an additional copy step for non-overlay Inodes.
(Overlay Inodes already do the extra copy).

PiperOrigin-RevId: 255477592
2019-06-27 14:24:03 -07:00
Andrei Vagin e276083903 gvisor/ptrace: grub initial thread registers only once
PiperOrigin-RevId: 255465635
2019-06-27 13:59:57 -07:00
gVisor bot 7188790f92 Merge pull request #461 from brb-g:128_procseekend
PiperOrigin-RevId: 255462850
2019-06-27 13:58:14 -07:00
Fabricio Voznika 42e212f6b7 Preserve permissions when checking lower
The code was wrongly assuming that only read access was
required from the lower overlay when checking for permissions.
This allowed non-writable files to be writable in the overlay.

Fixes #316

PiperOrigin-RevId: 255263686
2019-06-26 14:24:44 -07:00
Nicolas Lacasse 857e5c47e9 Follow symlinks when creating a file, and create the target.
If we have a symlink whose target does not exist, creating the symlink (either
via 'creat' or 'open' with O_CREAT flag) should create the target of the
symlink. Previously, gVisor would error with EEXIST in this case

PiperOrigin-RevId: 255232944
2019-06-26 11:49:20 -07:00
Nicolas Lacasse 67e2f227aa Always set SysProcAttr.Ctty to an FD in the child's FD table.
Go was going to change the behavior of SysProcAttr.Ctty such that it must be an
FD in the *parent* FD table:
https://go-review.googlesource.com/c/go/+/178919/

However, after some debate, it was decided that this change was too
backwards-incompatible, and so it was reverted.
https://github.com/golang/go/issues/29458

The behavior going forward is unchanged: the Ctty FD must be an FD in the
*child* FD table.

PiperOrigin-RevId: 255228476
2019-06-26 11:27:31 -07:00
Michael Pratt e98ce4a2c6 Add TODO reminder to remove tmpfs caching options
Updates #179

PiperOrigin-RevId: 255081565
2019-06-25 17:12:34 -07:00
Jamie Liu ffee0f36b1 Add //pkg/fdchannel.
To accompany flipcall connections in cases where passing FDs is required
(as for gofers).

PiperOrigin-RevId: 255062277
2019-06-25 15:38:11 -07:00