summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/ring0/pagetables
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2018-06-01 13:50:17 -0700
committerShentubot <shentubot@google.com>2018-06-01 13:51:16 -0700
commit659b10d1a6a236765be8b6e6dc0d72eaa55253ee (patch)
tree73f3134e6c617563cc508cb95217b86982ef7665 /pkg/sentry/platform/ring0/pagetables
parentd1ca50d49e52338feb1d46b69725b9ac21cc3ccc (diff)
Move page tables lock into the address space.
This is necessary to prevent races with invalidation. It is currently possible that page tables are garbage collected while paging caches refer to them. We must ensure that pages are held until caches can be invalidated. This is not achieved by this goal alone, but moving locking to outside the page tables themselves is a requisite. PiperOrigin-RevId: 198920784 Change-Id: I66fffecd49cb14aa2e676a84a68cabfc0c8b3e9a
Diffstat (limited to 'pkg/sentry/platform/ring0/pagetables')
-rw-r--r--pkg/sentry/platform/ring0/pagetables/pagetables.go8
1 files changed, 0 insertions, 8 deletions
diff --git a/pkg/sentry/platform/ring0/pagetables/pagetables.go b/pkg/sentry/platform/ring0/pagetables/pagetables.go
index 2df6792f7..2a83bbff2 100644
--- a/pkg/sentry/platform/ring0/pagetables/pagetables.go
+++ b/pkg/sentry/platform/ring0/pagetables/pagetables.go
@@ -16,8 +16,6 @@
package pagetables
import (
- "sync"
-
"gvisor.googlesource.com/gvisor/pkg/sentry/usermem"
)
@@ -39,8 +37,6 @@ type Node struct {
// PageTables is a set of page tables.
type PageTables struct {
- mu sync.Mutex
-
// root is the pagetable root.
root *Node
@@ -122,7 +118,6 @@ func (p *PageTables) Map(addr usermem.Addr, length uintptr, opts MapOpts, physic
return p.Unmap(addr, length)
}
prev := false
- p.mu.Lock()
end, ok := addr.AddLength(uint64(length))
if !ok {
panic("pagetables.Map: overflow")
@@ -139,7 +134,6 @@ func (p *PageTables) Map(addr usermem.Addr, length uintptr, opts MapOpts, physic
}
pte.Set(p, opts)
})
- p.mu.Unlock()
return prev
}
@@ -147,13 +141,11 @@ func (p *PageTables) Map(addr usermem.Addr, length uintptr, opts MapOpts, physic
//
// True is returned iff there was a previous mapping in the range.
func (p *PageTables) Unmap(addr usermem.Addr, length uintptr) bool {
- p.mu.Lock()
count := 0
p.iterateRange(uintptr(addr), uintptr(addr)+length, false, func(s, e uintptr, pte *PTE, align uintptr) {
pte.Clear()
count++
})
- p.mu.Unlock()
return count > 0
}