summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/mm
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/mm')
-rw-r--r--pkg/sentry/mm/pma.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/sentry/mm/pma.go b/pkg/sentry/mm/pma.go
index 5690fe6b4..63c50f719 100644
--- a/pkg/sentry/mm/pma.go
+++ b/pkg/sentry/mm/pma.go
@@ -138,6 +138,10 @@ func (mm *MemoryManager) getPMAsLocked(ctx context.Context, vseg vmaIterator, ar
var cowerr error
if opts.breakCOW {
+ if pend.Start() < ar.End {
+ // Adjust ar to reflect missing pmas.
+ ar.End = pend.Start()
+ }
var invalidated bool
pend, invalidated, cowerr = mm.breakCopyOnWriteLocked(pstart, ar)
if pend.Start() <= ar.Start {
@@ -189,6 +193,10 @@ func (mm *MemoryManager) getVecPMAsLocked(ctx context.Context, ars usermem.AddrR
if !pstart.Ok() {
pstart = mm.findOrSeekPrevUpperBoundPMA(ar.Start, pend)
}
+ if pend.Start() < ar.End {
+ // Adjust ar to reflect missing pmas.
+ ar.End = pend.Start()
+ }
pend, _, cowerr = mm.breakCopyOnWriteLocked(pstart, ar)
}