diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-10-08 23:26:15 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-08 23:26:15 +0000 |
commit | 6dbae823016113920fa330f4a90c08cce10a5b88 (patch) | |
tree | 8e9f45249240ff80ed1bcc0b2586bd9f74a8a594 /pkg/sentry/mm | |
parent | 0482839af380d44348da12e87886f83b9ccf4393 (diff) | |
parent | 6bad4851d4a04b5f56ade1f8ba68bd9c16471533 (diff) |
Merge release-20200928.0-72-g6bad4851d (automated)
Diffstat (limited to 'pkg/sentry/mm')
-rw-r--r-- | pkg/sentry/mm/mm.go | 6 | ||||
-rw-r--r-- | pkg/sentry/mm/mm_state_autogen.go | 3 | ||||
-rw-r--r-- | pkg/sentry/mm/syscalls.go | 12 |
3 files changed, 21 insertions, 0 deletions
diff --git a/pkg/sentry/mm/mm.go b/pkg/sentry/mm/mm.go index 43567b92c..92cc87d84 100644 --- a/pkg/sentry/mm/mm.go +++ b/pkg/sentry/mm/mm.go @@ -243,6 +243,12 @@ type MemoryManager struct { // // membarrierPrivateEnabled is accessed using atomic memory operations. membarrierPrivateEnabled uint32 + + // membarrierRSeqEnabled is non-zero if EnableMembarrierRSeq has previously + // been called. + // + // membarrierRSeqEnabled is accessed using atomic memory operations. + membarrierRSeqEnabled uint32 } // vma represents a virtual memory area. diff --git a/pkg/sentry/mm/mm_state_autogen.go b/pkg/sentry/mm/mm_state_autogen.go index 1636e5235..1fe9dfd7f 100644 --- a/pkg/sentry/mm/mm_state_autogen.go +++ b/pkg/sentry/mm/mm_state_autogen.go @@ -316,6 +316,7 @@ func (m *MemoryManager) StateFields() []string { "sleepForActivation", "vdsoSigReturnAddr", "membarrierPrivateEnabled", + "membarrierRSeqEnabled", } } @@ -350,6 +351,7 @@ func (m *MemoryManager) StateSave(stateSinkObject state.Sink) { stateSinkObject.Save(20, &m.sleepForActivation) stateSinkObject.Save(21, &m.vdsoSigReturnAddr) stateSinkObject.Save(22, &m.membarrierPrivateEnabled) + stateSinkObject.Save(23, &m.membarrierRSeqEnabled) } func (m *MemoryManager) StateLoad(stateSourceObject state.Source) { @@ -376,6 +378,7 @@ func (m *MemoryManager) StateLoad(stateSourceObject state.Source) { stateSourceObject.Load(20, &m.sleepForActivation) stateSourceObject.Load(21, &m.vdsoSigReturnAddr) stateSourceObject.Load(22, &m.membarrierPrivateEnabled) + stateSourceObject.Load(23, &m.membarrierRSeqEnabled) stateSourceObject.AfterLoad(m.afterLoad) } diff --git a/pkg/sentry/mm/syscalls.go b/pkg/sentry/mm/syscalls.go index 0a66b1cdd..675efdc7c 100644 --- a/pkg/sentry/mm/syscalls.go +++ b/pkg/sentry/mm/syscalls.go @@ -1287,3 +1287,15 @@ func (mm *MemoryManager) EnableMembarrierPrivate() { func (mm *MemoryManager) IsMembarrierPrivateEnabled() bool { return atomic.LoadUint32(&mm.membarrierPrivateEnabled) != 0 } + +// EnableMembarrierRSeq causes future calls to IsMembarrierRSeqEnabled to +// return true. +func (mm *MemoryManager) EnableMembarrierRSeq() { + atomic.StoreUint32(&mm.membarrierRSeqEnabled, 1) +} + +// IsMembarrierRSeqEnabled returns true if mm.EnableMembarrierRSeq() has +// previously been called. +func (mm *MemoryManager) IsMembarrierRSeqEnabled() bool { + return atomic.LoadUint32(&mm.membarrierRSeqEnabled) != 0 +} |