diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-08-21 00:50:30 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-08-21 00:50:30 +0000 |
commit | 1f33090b75cc2af7aea5c43b33098f3c19539620 (patch) | |
tree | 5dafd254b0fdc2577944a333a94cd6f2f5ae5fd7 /pkg | |
parent | cd7f3e7f6abea3036d84575f71a7d93c63f27726 (diff) | |
parent | 0e49e0821910ae03f029d372f9244148c214cb16 (diff) |
Merge release-20210806.0-52-g0e49e0821 (automated)
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/mm/aio_context.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/sentry/mm/aio_context.go b/pkg/sentry/mm/aio_context.go index b7f765cd7..d71d64580 100644 --- a/pkg/sentry/mm/aio_context.go +++ b/pkg/sentry/mm/aio_context.go @@ -77,15 +77,6 @@ func (mm *MemoryManager) destroyAIOContextLocked(ctx context.Context, id uint64) return nil } - // Only unmaps after it assured that the address is a valid aio context to - // prevent random memory from been unmapped. - // - // Note: It's possible to unmap this address and map something else into - // the same address. Then it would be unmapping memory that it doesn't own. - // This is, however, the way Linux implements AIO. Keeps the same [weird] - // semantics in case anyone relies on it. - mm.MUnmap(ctx, hostarch.Addr(id), aioRingBufferSize) - delete(mm.aioManager.contexts, id) aioCtx.destroy() return aioCtx @@ -411,6 +402,15 @@ func (mm *MemoryManager) DestroyAIOContext(ctx context.Context, id uint64) *AIOC return nil } + // Only unmaps after it assured that the address is a valid aio context to + // prevent random memory from been unmapped. + // + // Note: It's possible to unmap this address and map something else into + // the same address. Then it would be unmapping memory that it doesn't own. + // This is, however, the way Linux implements AIO. Keeps the same [weird] + // semantics in case anyone relies on it. + mm.MUnmap(ctx, hostarch.Addr(id), aioRingBufferSize) + mm.aioManager.mu.Lock() defer mm.aioManager.mu.Unlock() return mm.destroyAIOContextLocked(ctx, id) |