summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/epoll
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/kernel/epoll')
-rw-r--r--pkg/sentry/kernel/epoll/epoll.go15
-rw-r--r--pkg/sentry/kernel/epoll/epoll_state.go2
-rw-r--r--pkg/sentry/kernel/epoll/epoll_state_autogen.go37
3 files changed, 22 insertions, 32 deletions
diff --git a/pkg/sentry/kernel/epoll/epoll.go b/pkg/sentry/kernel/epoll/epoll.go
index 6006c46a9..8d0a21baf 100644
--- a/pkg/sentry/kernel/epoll/epoll.go
+++ b/pkg/sentry/kernel/epoll/epoll.go
@@ -66,7 +66,7 @@ type pollEntry struct {
file *refs.WeakRef `state:"manual"`
id FileIdentifier `state:"wait"`
userData [2]int32
- waiter waiter.Entry `state:"manual"`
+ waiter waiter.Entry
mask waiter.EventMask
flags EntryFlags
@@ -102,7 +102,7 @@ type EventPoll struct {
// Wait queue is used to notify interested parties when the event poll
// object itself becomes readable or writable.
- waiter.Queue `state:"zerovalue"`
+ waiter.Queue
// files is the map of all the files currently being observed, it is
// protected by mu.
@@ -454,14 +454,3 @@ func (e *EventPoll) RemoveEntry(ctx context.Context, id FileIdentifier) error {
return nil
}
-
-// UnregisterEpollWaiters removes the epoll waiter objects from the waiting
-// queues. This is different from Release() as the file is not dereferenced.
-func (e *EventPoll) UnregisterEpollWaiters() {
- e.mu.Lock()
- defer e.mu.Unlock()
-
- for _, entry := range e.files {
- entry.id.File.EventUnregister(&entry.waiter)
- }
-}
diff --git a/pkg/sentry/kernel/epoll/epoll_state.go b/pkg/sentry/kernel/epoll/epoll_state.go
index e08d6287f..135a6d72c 100644
--- a/pkg/sentry/kernel/epoll/epoll_state.go
+++ b/pkg/sentry/kernel/epoll/epoll_state.go
@@ -21,9 +21,7 @@ import (
// afterLoad is invoked by stateify.
func (p *pollEntry) afterLoad() {
- p.waiter.Callback = p
p.file = refs.NewWeakRef(p.id.File, p)
- p.id.File.EventRegister(&p.waiter, p.mask)
}
// afterLoad is invoked by stateify.
diff --git a/pkg/sentry/kernel/epoll/epoll_state_autogen.go b/pkg/sentry/kernel/epoll/epoll_state_autogen.go
index 44bd520ac..25fbc8f72 100644
--- a/pkg/sentry/kernel/epoll/epoll_state_autogen.go
+++ b/pkg/sentry/kernel/epoll/epoll_state_autogen.go
@@ -43,6 +43,7 @@ func (p *pollEntry) StateFields() []string {
"pollEntryEntry",
"id",
"userData",
+ "waiter",
"mask",
"flags",
"epoll",
@@ -57,9 +58,10 @@ func (p *pollEntry) StateSave(stateSinkObject state.Sink) {
stateSinkObject.Save(0, &p.pollEntryEntry)
stateSinkObject.Save(1, &p.id)
stateSinkObject.Save(2, &p.userData)
- stateSinkObject.Save(3, &p.mask)
- stateSinkObject.Save(4, &p.flags)
- stateSinkObject.Save(5, &p.epoll)
+ stateSinkObject.Save(3, &p.waiter)
+ stateSinkObject.Save(4, &p.mask)
+ stateSinkObject.Save(5, &p.flags)
+ stateSinkObject.Save(6, &p.epoll)
}
// +checklocksignore
@@ -67,9 +69,10 @@ func (p *pollEntry) StateLoad(stateSourceObject state.Source) {
stateSourceObject.Load(0, &p.pollEntryEntry)
stateSourceObject.LoadWait(1, &p.id)
stateSourceObject.Load(2, &p.userData)
- stateSourceObject.Load(3, &p.mask)
- stateSourceObject.Load(4, &p.flags)
- stateSourceObject.Load(5, &p.epoll)
+ stateSourceObject.Load(3, &p.waiter)
+ stateSourceObject.Load(4, &p.mask)
+ stateSourceObject.Load(5, &p.flags)
+ stateSourceObject.Load(6, &p.epoll)
stateSourceObject.AfterLoad(p.afterLoad)
}
@@ -79,6 +82,7 @@ func (e *EventPoll) StateTypeName() string {
func (e *EventPoll) StateFields() []string {
return []string{
+ "Queue",
"files",
"readyList",
"waitingList",
@@ -109,21 +113,20 @@ func (e *EventPoll) StateSave(stateSinkObject state.Sink) {
if !state.IsZeroValue(&e.FileNoMMap) {
state.Failf("FileNoMMap is %#v, expected zero", &e.FileNoMMap)
}
- if !state.IsZeroValue(&e.Queue) {
- state.Failf("Queue is %#v, expected zero", &e.Queue)
- }
- stateSinkObject.Save(0, &e.files)
- stateSinkObject.Save(1, &e.readyList)
- stateSinkObject.Save(2, &e.waitingList)
- stateSinkObject.Save(3, &e.disabledList)
+ stateSinkObject.Save(0, &e.Queue)
+ stateSinkObject.Save(1, &e.files)
+ stateSinkObject.Save(2, &e.readyList)
+ stateSinkObject.Save(3, &e.waitingList)
+ stateSinkObject.Save(4, &e.disabledList)
}
// +checklocksignore
func (e *EventPoll) StateLoad(stateSourceObject state.Source) {
- stateSourceObject.Load(0, &e.files)
- stateSourceObject.Load(1, &e.readyList)
- stateSourceObject.Load(2, &e.waitingList)
- stateSourceObject.Load(3, &e.disabledList)
+ stateSourceObject.Load(0, &e.Queue)
+ stateSourceObject.Load(1, &e.files)
+ stateSourceObject.Load(2, &e.readyList)
+ stateSourceObject.Load(3, &e.waitingList)
+ stateSourceObject.Load(4, &e.disabledList)
stateSourceObject.AfterLoad(e.afterLoad)
}