gvisor/pkg/sentry/syscalls
Jamie Liu 0d790cbaea Read vfs2 epoll events atomically.
Discovered by ayushranjan@:

VFS2 was employing the following algorithm for fetching ready events from an
epoll instance:
- Create a statically sized EpollEvent slice on the stack of size 16.
- Pass that to EpollInstance.ReadEvents() to populate.
   - EpollInstance.ReadEvents() requeues level-triggered events that it returns
     back into the ready queue.
- Write the results to usermem.
- If the number of results were = 16 then recall EpollInstance.ReadEvents() in
  the hopes of getting more. But this will cause duplication of the "requeued"
  ready level-triggered events.

So if the ready queue has >= 16 ready events, the EpollWait for loop will spin
until it fills the usermem with `maxEvents` events.

Fixes #3521

PiperOrigin-RevId: 331840527
2020-09-15 13:25:58 -07:00
..
linux Read vfs2 epoll events atomically. 2020-09-15 13:25:58 -07:00
BUILD Standardize on tools directory. 2020-01-27 12:21:00 -08:00
epoll.go Plumbing context.Context to DecRef() and Release(). 2020-08-03 13:36:05 -07:00
syscalls.go Cleanup straggling syscall dependencies. 2019-07-09 16:18:02 -07:00