diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-01-11 21:27:53 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-11 21:27:53 +0000 |
commit | e524c21569616484e3209be952dd90636209419e (patch) | |
tree | d425976e5c7d7499187b93feb31d97fbd11408bf /pkg/sentry/kernel | |
parent | 3ff3110fcdd696053e8cafc807f2409fe1269cce (diff) | |
parent | 4c4de66443174f2ed7f4fa533a1d09c709be9427 (diff) |
Merge release-20201216.0-82-g4c4de6644 (automated)
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r-- | pkg/sentry/kernel/epoll/epoll_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/futex/waiter_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/pending_signals_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/process_group_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/semaphore/waiter_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/session_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/socket_list.go | 28 | ||||
-rw-r--r-- | pkg/sentry/kernel/task_list.go | 28 |
8 files changed, 224 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/epoll/epoll_list.go b/pkg/sentry/kernel/epoll/epoll_list.go index 56d05c770..b6abe2de9 100644 --- a/pkg/sentry/kernel/epoll/epoll_list.go +++ b/pkg/sentry/kernel/epoll/epoll_list.go @@ -38,16 +38,22 @@ func (l *pollEntryList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *pollEntryList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *pollEntryList) Front() *pollEntry { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *pollEntryList) Back() *pollEntry { return l.tail } @@ -55,6 +61,8 @@ func (l *pollEntryList) Back() *pollEntry { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *pollEntryList) Len() (count int) { for e := l.Front(); e != nil; e = (pollEntryElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *pollEntryList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *pollEntryList) PushFront(e *pollEntry) { linker := pollEntryElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *pollEntryList) PushFront(e *pollEntry) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *pollEntryList) PushBack(e *pollEntry) { linker := pollEntryElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *pollEntryList) PushBack(e *pollEntry) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *pollEntryList) PushBackList(m *pollEntryList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *pollEntryList) PushBackList(m *pollEntryList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *pollEntryList) InsertAfter(b, e *pollEntry) { bLinker := pollEntryElementMapper{}.linkerFor(b) eLinker := pollEntryElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *pollEntryList) InsertAfter(b, e *pollEntry) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *pollEntryList) InsertBefore(a, e *pollEntry) { aLinker := pollEntryElementMapper{}.linkerFor(a) eLinker := pollEntryElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *pollEntryList) InsertBefore(a, e *pollEntry) { } // Remove removes e from l. +// +//go:nosplit func (l *pollEntryList) Remove(e *pollEntry) { linker := pollEntryElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type pollEntryEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *pollEntryEntry) Next() *pollEntry { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *pollEntryEntry) Prev() *pollEntry { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *pollEntryEntry) SetNext(elem *pollEntry) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *pollEntryEntry) SetPrev(elem *pollEntry) { e.prev = elem } diff --git a/pkg/sentry/kernel/futex/waiter_list.go b/pkg/sentry/kernel/futex/waiter_list.go index ab6997b26..24968ce4b 100644 --- a/pkg/sentry/kernel/futex/waiter_list.go +++ b/pkg/sentry/kernel/futex/waiter_list.go @@ -38,16 +38,22 @@ func (l *waiterList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *waiterList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *waiterList) Front() *Waiter { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *waiterList) Back() *Waiter { return l.tail } @@ -55,6 +61,8 @@ func (l *waiterList) Back() *Waiter { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *waiterList) Len() (count int) { for e := l.Front(); e != nil; e = (waiterElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *waiterList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *waiterList) PushFront(e *Waiter) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *waiterList) PushFront(e *Waiter) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *waiterList) PushBack(e *Waiter) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *waiterList) PushBack(e *Waiter) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *waiterList) PushBackList(m *waiterList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *waiterList) PushBackList(m *waiterList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *waiterList) InsertAfter(b, e *Waiter) { bLinker := waiterElementMapper{}.linkerFor(b) eLinker := waiterElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *waiterList) InsertAfter(b, e *Waiter) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *waiterList) InsertBefore(a, e *Waiter) { aLinker := waiterElementMapper{}.linkerFor(a) eLinker := waiterElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *waiterList) InsertBefore(a, e *Waiter) { } // Remove removes e from l. +// +//go:nosplit func (l *waiterList) Remove(e *Waiter) { linker := waiterElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type waiterEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) Next() *Waiter { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) Prev() *Waiter { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) SetNext(elem *Waiter) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) SetPrev(elem *Waiter) { e.prev = elem } diff --git a/pkg/sentry/kernel/pending_signals_list.go b/pkg/sentry/kernel/pending_signals_list.go index d0062087a..d5b483b3e 100644 --- a/pkg/sentry/kernel/pending_signals_list.go +++ b/pkg/sentry/kernel/pending_signals_list.go @@ -38,16 +38,22 @@ func (l *pendingSignalList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *pendingSignalList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *pendingSignalList) Front() *pendingSignal { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *pendingSignalList) Back() *pendingSignal { return l.tail } @@ -55,6 +61,8 @@ func (l *pendingSignalList) Back() *pendingSignal { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *pendingSignalList) Len() (count int) { for e := l.Front(); e != nil; e = (pendingSignalElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *pendingSignalList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *pendingSignalList) PushFront(e *pendingSignal) { linker := pendingSignalElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *pendingSignalList) PushFront(e *pendingSignal) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *pendingSignalList) PushBack(e *pendingSignal) { linker := pendingSignalElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *pendingSignalList) PushBack(e *pendingSignal) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *pendingSignalList) PushBackList(m *pendingSignalList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *pendingSignalList) PushBackList(m *pendingSignalList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *pendingSignalList) InsertAfter(b, e *pendingSignal) { bLinker := pendingSignalElementMapper{}.linkerFor(b) eLinker := pendingSignalElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *pendingSignalList) InsertAfter(b, e *pendingSignal) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *pendingSignalList) InsertBefore(a, e *pendingSignal) { aLinker := pendingSignalElementMapper{}.linkerFor(a) eLinker := pendingSignalElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *pendingSignalList) InsertBefore(a, e *pendingSignal) { } // Remove removes e from l. +// +//go:nosplit func (l *pendingSignalList) Remove(e *pendingSignal) { linker := pendingSignalElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type pendingSignalEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *pendingSignalEntry) Next() *pendingSignal { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *pendingSignalEntry) Prev() *pendingSignal { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *pendingSignalEntry) SetNext(elem *pendingSignal) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *pendingSignalEntry) SetPrev(elem *pendingSignal) { e.prev = elem } diff --git a/pkg/sentry/kernel/process_group_list.go b/pkg/sentry/kernel/process_group_list.go index bc2df5bce..9c493504d 100644 --- a/pkg/sentry/kernel/process_group_list.go +++ b/pkg/sentry/kernel/process_group_list.go @@ -38,16 +38,22 @@ func (l *processGroupList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *processGroupList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *processGroupList) Front() *ProcessGroup { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *processGroupList) Back() *ProcessGroup { return l.tail } @@ -55,6 +61,8 @@ func (l *processGroupList) Back() *ProcessGroup { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *processGroupList) Len() (count int) { for e := l.Front(); e != nil; e = (processGroupElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *processGroupList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *processGroupList) PushFront(e *ProcessGroup) { linker := processGroupElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *processGroupList) PushFront(e *ProcessGroup) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *processGroupList) PushBack(e *ProcessGroup) { linker := processGroupElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *processGroupList) PushBack(e *ProcessGroup) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *processGroupList) PushBackList(m *processGroupList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *processGroupList) PushBackList(m *processGroupList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *processGroupList) InsertAfter(b, e *ProcessGroup) { bLinker := processGroupElementMapper{}.linkerFor(b) eLinker := processGroupElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *processGroupList) InsertAfter(b, e *ProcessGroup) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *processGroupList) InsertBefore(a, e *ProcessGroup) { aLinker := processGroupElementMapper{}.linkerFor(a) eLinker := processGroupElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *processGroupList) InsertBefore(a, e *ProcessGroup) { } // Remove removes e from l. +// +//go:nosplit func (l *processGroupList) Remove(e *ProcessGroup) { linker := processGroupElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type processGroupEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *processGroupEntry) Next() *ProcessGroup { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *processGroupEntry) Prev() *ProcessGroup { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *processGroupEntry) SetNext(elem *ProcessGroup) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *processGroupEntry) SetPrev(elem *ProcessGroup) { e.prev = elem } diff --git a/pkg/sentry/kernel/semaphore/waiter_list.go b/pkg/sentry/kernel/semaphore/waiter_list.go index 007bf67b0..51586d43f 100644 --- a/pkg/sentry/kernel/semaphore/waiter_list.go +++ b/pkg/sentry/kernel/semaphore/waiter_list.go @@ -38,16 +38,22 @@ func (l *waiterList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *waiterList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *waiterList) Front() *waiter { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *waiterList) Back() *waiter { return l.tail } @@ -55,6 +61,8 @@ func (l *waiterList) Back() *waiter { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *waiterList) Len() (count int) { for e := l.Front(); e != nil; e = (waiterElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *waiterList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *waiterList) PushFront(e *waiter) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *waiterList) PushFront(e *waiter) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *waiterList) PushBack(e *waiter) { linker := waiterElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *waiterList) PushBack(e *waiter) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *waiterList) PushBackList(m *waiterList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *waiterList) PushBackList(m *waiterList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *waiterList) InsertAfter(b, e *waiter) { bLinker := waiterElementMapper{}.linkerFor(b) eLinker := waiterElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *waiterList) InsertAfter(b, e *waiter) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *waiterList) InsertBefore(a, e *waiter) { aLinker := waiterElementMapper{}.linkerFor(a) eLinker := waiterElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *waiterList) InsertBefore(a, e *waiter) { } // Remove removes e from l. +// +//go:nosplit func (l *waiterList) Remove(e *waiter) { linker := waiterElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type waiterEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) Next() *waiter { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) Prev() *waiter { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *waiterEntry) SetNext(elem *waiter) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *waiterEntry) SetPrev(elem *waiter) { e.prev = elem } diff --git a/pkg/sentry/kernel/session_list.go b/pkg/sentry/kernel/session_list.go index c328b2526..f53dea401 100644 --- a/pkg/sentry/kernel/session_list.go +++ b/pkg/sentry/kernel/session_list.go @@ -38,16 +38,22 @@ func (l *sessionList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *sessionList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *sessionList) Front() *Session { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *sessionList) Back() *Session { return l.tail } @@ -55,6 +61,8 @@ func (l *sessionList) Back() *Session { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *sessionList) Len() (count int) { for e := l.Front(); e != nil; e = (sessionElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *sessionList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *sessionList) PushFront(e *Session) { linker := sessionElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *sessionList) PushFront(e *Session) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *sessionList) PushBack(e *Session) { linker := sessionElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *sessionList) PushBack(e *Session) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *sessionList) PushBackList(m *sessionList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *sessionList) PushBackList(m *sessionList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *sessionList) InsertAfter(b, e *Session) { bLinker := sessionElementMapper{}.linkerFor(b) eLinker := sessionElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *sessionList) InsertAfter(b, e *Session) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *sessionList) InsertBefore(a, e *Session) { aLinker := sessionElementMapper{}.linkerFor(a) eLinker := sessionElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *sessionList) InsertBefore(a, e *Session) { } // Remove removes e from l. +// +//go:nosplit func (l *sessionList) Remove(e *Session) { linker := sessionElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type sessionEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *sessionEntry) Next() *Session { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *sessionEntry) Prev() *Session { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *sessionEntry) SetNext(elem *Session) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *sessionEntry) SetPrev(elem *Session) { e.prev = elem } diff --git a/pkg/sentry/kernel/socket_list.go b/pkg/sentry/kernel/socket_list.go index 246fba405..2b2f5055e 100644 --- a/pkg/sentry/kernel/socket_list.go +++ b/pkg/sentry/kernel/socket_list.go @@ -38,16 +38,22 @@ func (l *socketList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *socketList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *socketList) Front() *SocketRecordVFS1 { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *socketList) Back() *SocketRecordVFS1 { return l.tail } @@ -55,6 +61,8 @@ func (l *socketList) Back() *SocketRecordVFS1 { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *socketList) Len() (count int) { for e := l.Front(); e != nil; e = (socketElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *socketList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *socketList) PushFront(e *SocketRecordVFS1) { linker := socketElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *socketList) PushFront(e *SocketRecordVFS1) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *socketList) PushBack(e *SocketRecordVFS1) { linker := socketElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *socketList) PushBack(e *SocketRecordVFS1) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *socketList) PushBackList(m *socketList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *socketList) PushBackList(m *socketList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *socketList) InsertAfter(b, e *SocketRecordVFS1) { bLinker := socketElementMapper{}.linkerFor(b) eLinker := socketElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *socketList) InsertAfter(b, e *SocketRecordVFS1) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *socketList) InsertBefore(a, e *SocketRecordVFS1) { aLinker := socketElementMapper{}.linkerFor(a) eLinker := socketElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *socketList) InsertBefore(a, e *SocketRecordVFS1) { } // Remove removes e from l. +// +//go:nosplit func (l *socketList) Remove(e *SocketRecordVFS1) { linker := socketElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type socketEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *socketEntry) Next() *SocketRecordVFS1 { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *socketEntry) Prev() *SocketRecordVFS1 { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *socketEntry) SetNext(elem *SocketRecordVFS1) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *socketEntry) SetPrev(elem *SocketRecordVFS1) { e.prev = elem } diff --git a/pkg/sentry/kernel/task_list.go b/pkg/sentry/kernel/task_list.go index f0c501845..66df9ac45 100644 --- a/pkg/sentry/kernel/task_list.go +++ b/pkg/sentry/kernel/task_list.go @@ -38,16 +38,22 @@ func (l *taskList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *taskList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *taskList) Front() *Task { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *taskList) Back() *Task { return l.tail } @@ -55,6 +61,8 @@ func (l *taskList) Back() *Task { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *taskList) Len() (count int) { for e := l.Front(); e != nil; e = (taskElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *taskList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *taskList) PushFront(e *Task) { linker := taskElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *taskList) PushFront(e *Task) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *taskList) PushBack(e *Task) { linker := taskElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *taskList) PushBack(e *Task) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *taskList) PushBackList(m *taskList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *taskList) PushBackList(m *taskList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *taskList) InsertAfter(b, e *Task) { bLinker := taskElementMapper{}.linkerFor(b) eLinker := taskElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *taskList) InsertAfter(b, e *Task) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *taskList) InsertBefore(a, e *Task) { aLinker := taskElementMapper{}.linkerFor(a) eLinker := taskElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *taskList) InsertBefore(a, e *Task) { } // Remove removes e from l. +// +//go:nosplit func (l *taskList) Remove(e *Task) { linker := taskElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type taskEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *taskEntry) Next() *Task { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *taskEntry) Prev() *Task { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *taskEntry) SetNext(elem *Task) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *taskEntry) SetPrev(elem *Task) { e.prev = elem } |