mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Truncate ar before calling mm.breakCopyOnWriteLocked().
... as required by the latter's precondition. PiperOrigin-RevId: 226033824 Change-Id: I6bc46d0e100c61cc58cb5fc69e70c4ca905cd92d
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user