summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/mm
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/mm')
-rw-r--r--pkg/sentry/mm/mm.go6
-rw-r--r--pkg/sentry/mm/mm_state_autogen.go3
-rw-r--r--pkg/sentry/mm/syscalls.go12
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
+}