[PATCH] ntdll: Fix race condition with fd_cache when duplicating handle.

Alexandre Julliard julliard at winehq.org
Tue Feb 9 06:02:33 CST 2021


Daniel Lehman <dlehman25 at gmail.com> writes:

> @@ -1639,7 +1639,10 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source, HANDLE
>                                     ACCESS_MASK access, ULONG attributes, ULONG options )
>  {
>      NTSTATUS ret;
> +    int fd = -1;
>  
> +    if (options & DUPLICATE_CLOSE_SOURCE)
> +        fd = remove_fd_from_cache( source );

I'm afraid it's not that simple, there's no guarantee that the source
handle is for the current process.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list