summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/kernel')
-rwxr-xr-xpkg/sentry/kernel/epoll/epoll_list.go8
-rw-r--r--pkg/sentry/kernel/epoll/epoll_state.go13
-rwxr-xr-xpkg/sentry/kernel/futex/waiter_list.go8
-rwxr-xr-xpkg/sentry/kernel/pending_signals_list.go8
-rwxr-xr-xpkg/sentry/kernel/process_group_list.go8
-rwxr-xr-xpkg/sentry/kernel/semaphore/waiter_list.go8
-rwxr-xr-xpkg/sentry/kernel/session_list.go8
-rwxr-xr-xpkg/sentry/kernel/socket_list.go8
-rwxr-xr-xpkg/sentry/kernel/task_list.go8
9 files changed, 56 insertions, 21 deletions
diff --git a/pkg/sentry/kernel/epoll/epoll_list.go b/pkg/sentry/kernel/epoll/epoll_list.go
index 5ac854e38..37f757fa8 100755
--- a/pkg/sentry/kernel/epoll/epoll_list.go
+++ b/pkg/sentry/kernel/epoll/epoll_list.go
@@ -135,8 +135,9 @@ func (l *pollEntryList) InsertBefore(a, e *pollEntry) {
// Remove removes e from l.
func (l *pollEntryList) Remove(e *pollEntry) {
- prev := pollEntryElementMapper{}.linkerFor(e).Prev()
- next := pollEntryElementMapper{}.linkerFor(e).Next()
+ linker := pollEntryElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
pollEntryElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *pollEntryList) Remove(e *pollEntry) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/epoll/epoll_state.go b/pkg/sentry/kernel/epoll/epoll_state.go
index a0d35d350..8e9f200d0 100644
--- a/pkg/sentry/kernel/epoll/epoll_state.go
+++ b/pkg/sentry/kernel/epoll/epoll_state.go
@@ -38,11 +38,14 @@ func (e *EventPoll) afterLoad() {
}
}
- for it := e.waitingList.Front(); it != nil; it = it.Next() {
- if it.id.File.Readiness(it.mask) != 0 {
- e.waitingList.Remove(it)
- e.readyList.PushBack(it)
- it.curList = &e.readyList
+ for it := e.waitingList.Front(); it != nil; {
+ entry := it
+ it = it.Next()
+
+ if entry.id.File.Readiness(entry.mask) != 0 {
+ e.waitingList.Remove(entry)
+ e.readyList.PushBack(entry)
+ entry.curList = &e.readyList
e.Notify(waiter.EventIn)
}
}
diff --git a/pkg/sentry/kernel/futex/waiter_list.go b/pkg/sentry/kernel/futex/waiter_list.go
index b6baa1b5b..204eededf 100755
--- a/pkg/sentry/kernel/futex/waiter_list.go
+++ b/pkg/sentry/kernel/futex/waiter_list.go
@@ -135,8 +135,9 @@ func (l *waiterList) InsertBefore(a, e *Waiter) {
// Remove removes e from l.
func (l *waiterList) Remove(e *Waiter) {
- prev := waiterElementMapper{}.linkerFor(e).Prev()
- next := waiterElementMapper{}.linkerFor(e).Next()
+ linker := waiterElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
waiterElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *waiterList) Remove(e *Waiter) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/pending_signals_list.go b/pkg/sentry/kernel/pending_signals_list.go
index 26b9ffd98..8eb40ac2c 100755
--- a/pkg/sentry/kernel/pending_signals_list.go
+++ b/pkg/sentry/kernel/pending_signals_list.go
@@ -135,8 +135,9 @@ func (l *pendingSignalList) InsertBefore(a, e *pendingSignal) {
// Remove removes e from l.
func (l *pendingSignalList) Remove(e *pendingSignal) {
- prev := pendingSignalElementMapper{}.linkerFor(e).Prev()
- next := pendingSignalElementMapper{}.linkerFor(e).Next()
+ linker := pendingSignalElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
pendingSignalElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *pendingSignalList) Remove(e *pendingSignal) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/process_group_list.go b/pkg/sentry/kernel/process_group_list.go
index 2c5363c69..40c1a13a4 100755
--- a/pkg/sentry/kernel/process_group_list.go
+++ b/pkg/sentry/kernel/process_group_list.go
@@ -135,8 +135,9 @@ func (l *processGroupList) InsertBefore(a, e *ProcessGroup) {
// Remove removes e from l.
func (l *processGroupList) Remove(e *ProcessGroup) {
- prev := processGroupElementMapper{}.linkerFor(e).Prev()
- next := processGroupElementMapper{}.linkerFor(e).Next()
+ linker := processGroupElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
processGroupElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *processGroupList) Remove(e *ProcessGroup) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/semaphore/waiter_list.go b/pkg/sentry/kernel/semaphore/waiter_list.go
index 78d86900a..27120afe3 100755
--- a/pkg/sentry/kernel/semaphore/waiter_list.go
+++ b/pkg/sentry/kernel/semaphore/waiter_list.go
@@ -135,8 +135,9 @@ func (l *waiterList) InsertBefore(a, e *waiter) {
// Remove removes e from l.
func (l *waiterList) Remove(e *waiter) {
- prev := waiterElementMapper{}.linkerFor(e).Prev()
- next := waiterElementMapper{}.linkerFor(e).Next()
+ linker := waiterElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
waiterElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *waiterList) Remove(e *waiter) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/session_list.go b/pkg/sentry/kernel/session_list.go
index e65688f53..8174f413d 100755
--- a/pkg/sentry/kernel/session_list.go
+++ b/pkg/sentry/kernel/session_list.go
@@ -135,8 +135,9 @@ func (l *sessionList) InsertBefore(a, e *Session) {
// Remove removes e from l.
func (l *sessionList) Remove(e *Session) {
- prev := sessionElementMapper{}.linkerFor(e).Prev()
- next := sessionElementMapper{}.linkerFor(e).Next()
+ linker := sessionElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
sessionElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *sessionList) Remove(e *Session) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/socket_list.go b/pkg/sentry/kernel/socket_list.go
index a3d47e381..ac93e2365 100755
--- a/pkg/sentry/kernel/socket_list.go
+++ b/pkg/sentry/kernel/socket_list.go
@@ -135,8 +135,9 @@ func (l *socketList) InsertBefore(a, e *SocketEntry) {
// Remove removes e from l.
func (l *socketList) Remove(e *SocketEntry) {
- prev := socketElementMapper{}.linkerFor(e).Prev()
- next := socketElementMapper{}.linkerFor(e).Next()
+ linker := socketElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
socketElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *socketList) Remove(e *SocketEntry) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields
diff --git a/pkg/sentry/kernel/task_list.go b/pkg/sentry/kernel/task_list.go
index 9b8f07b46..4dfcdbf2c 100755
--- a/pkg/sentry/kernel/task_list.go
+++ b/pkg/sentry/kernel/task_list.go
@@ -135,8 +135,9 @@ func (l *taskList) InsertBefore(a, e *Task) {
// Remove removes e from l.
func (l *taskList) Remove(e *Task) {
- prev := taskElementMapper{}.linkerFor(e).Prev()
- next := taskElementMapper{}.linkerFor(e).Next()
+ linker := taskElementMapper{}.linkerFor(e)
+ prev := linker.Prev()
+ next := linker.Next()
if prev != nil {
taskElementMapper{}.linkerFor(prev).SetNext(next)
@@ -149,6 +150,9 @@ func (l *taskList) Remove(e *Task) {
} else {
l.tail = prev
}
+
+ linker.SetNext(nil)
+ linker.SetPrev(nil)
}
// Entry is a default implementation of Linker. Users can add anonymous fields