Philip Guenther wrote:
> Yes, two _MALLOC_LEAVE calls can occur without a _MALLOC_ENTRY between them.
> 
>   T1 -> MALLOC_LOCK, do stuff
>   T2 -> block in MALLOC_LOCK
>   T1 -> MALLOC_LEAVE, MMAP()
>         unmap_me is still set, but to an already unmaped region
>   T2 -> return from MALLOC_LOCK, do stuff
>   T1 -> block in MALLOC_ENTRY
>   T2 -> MALLOC_LEAVE
>        this unmaps the same unmap_me from above, which may have
> already been mapped by some other thread
> 
> MALLOC_LEAVE must clear unmap_me after copying the value into local
> variables and before releasing the lock, MALLOC_ENTRY shouldn't touch
> them at all.

AH! the light goes on. I incorrectly thought MALLOC ENTER/LEAVE were the
functions called everywhere. having a separate set of LOCK/UNLOCK calls
elsewhere is trouble.

This could be reworked to consistently use ENTER/LEAVE, but not today.

Reply via email to