@@ -349,6 +349,8 @@ func (cc *taskCopyContext) CopyScratchBuffer(size int) []byte {
349
349
}
350
350
351
351
func (cc * taskCopyContext ) getMemoryManager () (* mm.MemoryManager , error ) {
352
+ cc .t .mu .Lock ()
353
+ defer cc .t .mu .Unlock ()
352
354
tmm := cc .t .MemoryManager ()
353
355
if tmm == nil {
354
356
return nil , linuxerr .ESRCH
@@ -360,10 +362,6 @@ func (cc *taskCopyContext) getMemoryManager() (*mm.MemoryManager, error) {
360
362
}
361
363
362
364
// CopyInBytes implements marshal.CopyContext.CopyInBytes.
363
- //
364
- // Preconditions: Same as usermem.IO.CopyIn, plus:
365
- // - The caller must be running on the task goroutine or hold the cc.t.mu
366
- // - t's AddressSpace must be active.
367
365
func (cc * taskCopyContext ) CopyInBytes (addr hostarch.Addr , dst []byte ) (int , error ) {
368
366
tmm , err := cc .getMemoryManager ()
369
367
if err != nil {
@@ -374,10 +372,6 @@ func (cc *taskCopyContext) CopyInBytes(addr hostarch.Addr, dst []byte) (int, err
374
372
}
375
373
376
374
// CopyOutBytes implements marshal.CopyContext.CopyOutBytes.
377
- //
378
- // Preconditions: Same as usermem.IO.CopyOut, plus:
379
- // - The caller must be running on the task goroutine or hold the cc.t.mu
380
- // - t's AddressSpace must be active.
381
375
func (cc * taskCopyContext ) CopyOutBytes (addr hostarch.Addr , src []byte ) (int , error ) {
382
376
tmm , err := cc .getMemoryManager ()
383
377
if err != nil {
0 commit comments