[PATCH] ntdll: Fix race condition in RtlCreateHeap()

Bart Van Assche bvanassche at acm.org
Sun Mar 13 14:25:00 CDT 2011


On Mon, Feb 28, 2011 at 12:21 PM, Bart Van Assche <bvanassche at acm.org> wrote:
>
> Other threads may access a heap as soon as it has been added to the
> processHeap list. So the heap debug flags should be set before it has
> been added to that list instead of after. This issue was detected by the
> Valgrind DRD tool.
>
> Signed-off-by: Bart Van Assche <bvanassche at acm.org>
>
> ---
>  dlls/ntdll/heap.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
> index df94410..2e945e9 100644
> --- a/dlls/ntdll/heap.c
> +++ b/dlls/ntdll/heap.c
> @@ -1538,6 +1538,8 @@ HANDLE WINAPI RtlCreateHeap( ULONG flags, PVOID
> addr, SIZE_T totalSize, SIZE_T c
>
>     if (!(subheap = HEAP_CreateSubHeap( NULL, addr, flags,
> commitSize, totalSize ))) return 0;
>
> +    heap_set_debug_flags( subheap->heap );
> +
>     /* link it into the per-process heap list */
>     if (processHeap)
>     {
> @@ -1552,7 +1554,6 @@ HANDLE WINAPI RtlCreateHeap( ULONG flags, PVOID
> addr, SIZE_T totalSize, SIZE_T c
>         list_init( &processHeap->entry );
>     }
>
> -    heap_set_debug_flags( subheap->heap );
>     return subheap->heap;
>  }

Hello,

Has anyone already had the time to review this patch ? If not, what's
a reasonable time-frame to expect feedback about a patch ?

Thanks,

Bart.



More information about the wine-patches mailing list