Commit Graph

1512 Commits

Author SHA1 Message Date
Jamie Liu 18c2463596 Fix strace for epoll event arrays.
PiperOrigin-RevId: 323491461
2020-07-27 19:27:14 -07:00
gVisor bot b0eafc7454 Merge pull request #3201 from lubinszARM:pr_sys64_2
PiperOrigin-RevId: 323456118
2020-07-27 15:46:33 -07:00
gVisor bot 1b2006083c Merge pull request #3299 from lubinszARM:pr_asid
PiperOrigin-RevId: 323455097
2020-07-27 15:44:30 -07:00
gVisor bot 9a4ad9d5e7 Merge pull request #2958 from lubinszARM:pr_vfs2_1
PiperOrigin-RevId: 323443142
2020-07-27 14:38:45 -07:00
Ridwan Sharif 112eb0c5b9 Add device implementation for /dev/fuse
This PR adds the following:
  - [x] Marshall-able structs for fuse headers
  - [x] Data structures needed in /dev/fuse to communicate with the daemon server
  - [x] Implementation of the device interface
  - [x] Go unit tests

This change adds the `/dev/fuse` implementation. `Connection` controls the
communication between the server and the sentry.  The FUSE server uses
the `FileDescription` interface to interact with the Sentry. The Sentry
implmenetation of fusefs, uses `Connection` and the Connection interface
to interact with the Server. All communication messages are in the form
of `go_marshal` backed structs defined in the ABI package.

This change also adds some go unit tests that test (pretty basically)
the interfaces and should be used as an example of an end to end FUSE
operation.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/3083 from ridwanmsharif:ridwanmsharif/fuse-device-impl 69aa2ce970004938fe9f918168dfe57636ab856e
PiperOrigin-RevId: 323428180
2020-07-27 13:34:44 -07:00
Andrei Vagin f347a578b7 Move platform.File in memmap
The subsequent systrap changes will need to import memmap from
the platform package.

PiperOrigin-RevId: 323409486
2020-07-27 11:59:10 -07:00
Bin Lu ced5863c49 allow guest user applications read CNTVCT_EL0/CNTFRQ_EL0
At present, when doing syscall_kvm test, we need to
enable the function of ESR_ELx_SYS64_ISS_SYS_CNTVCT/ESR_ELx_SYS64_ISS_SYS_CNTFRQ to
successfully pass the test.

I set CNTKCTL_EL1.EL0VCTEN==1/CNTKCTL_EL1.EL0PCTEN==1, so that the related cases can passed.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-07-26 22:25:27 -04:00
Ayush Ranjan e2c70ee981 Enable automated marshalling for netstack.
PiperOrigin-RevId: 322954792
2020-07-24 01:25:39 -07:00
gVisor bot 5e7ae04766 Merge pull request #3142 from tanjianfeng:fix-3141
PiperOrigin-RevId: 322937495
2020-07-23 22:25:14 -07:00
Dean Deng d9a3f5d0c7 Add permission checks to vfs2 truncate.
- Check write permission on truncate(2). Unlike ftruncate(2),
  truncate(2) fails if the user does not have write permissions
  on the file.
- For gofers under InteropModeShared, check file type before
  making a truncate request. We should fail early and avoid
  making an rpc when possible. Furthermore, depending on the
  remote host's failure may give us unexpected behavior--if the
  host converts the truncate request to an ftruncate syscall on
  an open fd, we will get EINVAL instead of EISDIR.

Updates #2923.

PiperOrigin-RevId: 322913569
2020-07-23 18:52:44 -07:00
Dean Deng bac4ebaabf FileDescription is hard to spell.
Fix typos.

PiperOrigin-RevId: 322913282
2020-07-23 18:45:24 -07:00
Sam Balana 82a5cada59 Add AfterFunc to tcpip.Clock
Changes the API of tcpip.Clock to also provide a method for scheduling and
rescheduling work after a specified duration. This change also implements the
AfterFunc method for existing implementations of tcpip.Clock.

This is the groundwork required to mock time within tests. All references to
CancellableTimer has been replaced with the tcpip.Job interface, allowing for
custom implementations of scheduling work.

This is a BREAKING CHANGE for clients that implement their own tcpip.Clock or
use tcpip.CancellableTimer. Migration plan:
 1. Add AfterFunc(d, f) to tcpip.Clock
 2. Replace references of tcpip.CancellableTimer with tcpip.Job
 3. Replace calls to tcpip.CancellableTimer#StopLocked with tcpip.Job#Cancel
 4. Replace calls to tcpip.CancellableTimer#Reset with tcpip.Job#Schedule
 5. Replace calls to tcpip.NewCancellableTimer with tcpip.NewJob.

PiperOrigin-RevId: 322906897
2020-07-23 18:00:43 -07:00
Nicolas Lacasse 4ec3516332 Implement get/set_robust_list.
PiperOrigin-RevId: 322904430
2020-07-23 17:42:50 -07:00
gVisor bot 5e34ee68c9 Merge pull request #3024 from ridwanmsharif:ridwanmsharif/fuse-stub-impl
PiperOrigin-RevId: 322890087
2020-07-23 16:34:09 -07:00
Dean Deng 8fed97794e Add task work mechanism.
Like task_work in Linux, this allows us to register callbacks to be executed
before returning to userspace. This is needed for kcov support, which requires
coverage information to be up-to-date whenever we are in user mode. We will
provide coverage data through the kcov interface to enable coverage-directed
fuzzing in syzkaller.

One difference from Linux is that task work cannot queue work before the
transition to userspace that it precedes; queued work will be picked up before
the next transition.

PiperOrigin-RevId: 322889984
2020-07-23 16:25:34 -07:00
lubinszARM 4eb3c8c7e5 kvm-tls-2:add the preservation of user-TLS in the Arm64 kvm platform
This patch load/save TLS for the container application.

Related issue: full context-switch supporting for Arm64 #1238

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/2761 from lubinszARM:pr_tls_2 cb5dbca1c9c3f378002406da7a58887f9b5032b3
PiperOrigin-RevId: 322887044
2020-07-23 16:08:16 -07:00
Ridwan Sharif 2f78c487f1 Use mode supplied by the mount options 2020-07-23 17:13:24 -04:00
Ridwan Sharif 3e0e3b9b11 Added stub FUSE filesystem
Allow FUSE filesystems to be mounted using libfuse.
The appropriate flags and mount options are parsed and
understood by fusefs.
2020-07-23 17:13:24 -04:00
Ayush Ranjan 6f7f739967 Marshallable socket opitons.
Socket option values are now required to implement marshal.Marshallable.

Co-authored-by: Rahat Mahmood <rahat@google.com>
PiperOrigin-RevId: 322831612
2020-07-23 11:45:10 -07:00
Nicolas Lacasse b396d3882c Port sendfile to vfs2.
And do some refactoring of the wait logic in sendfile/splice/tee.

Updates #1035 #2923

PiperOrigin-RevId: 322815521
2020-07-23 10:36:17 -07:00
Ayush Ranjan 4fbd0728ac [vfs2][gofer] Fix update attributes race condition.
We were getting the file attributes before locking the metadataMu which was
causing stale updates to the file attributes.

Fixes OpenTest_AppendConcurrentWrite.

Updates #2923

PiperOrigin-RevId: 322804438
2020-07-23 09:45:26 -07:00
Kevin Krakauer bd98f82014 iptables: replace maps with arrays
For iptables users, Check() is a hot path called for every packet one or more
times. Let's avoid a bunch of map lookups.

PiperOrigin-RevId: 322678699
2020-07-22 16:23:55 -07:00
Ayush Ranjan 9654bf04ac [vfs2][tmpfs] Implement O_APPEND
Updates #2923

PiperOrigin-RevId: 322671489
2020-07-22 15:48:43 -07:00
Ayush Ranjan 39525d64cb Add O_APPEND support in vfs2 gofer.
Helps in fixing open syscall tests: AppendConcurrentWrite and AppendOnly.

We also now update the file size for seekable special files (regular files)
which we were not doing earlier.

Updates #2923

PiperOrigin-RevId: 322670843
2020-07-22 15:42:33 -07:00
Bhasker Hariharan 71bf90c55b Support for receiving outbound packets in AF_PACKET.
Updates #173

PiperOrigin-RevId: 322665518
2020-07-22 15:33:33 -07:00