[Bug 50292] Process-local synchronization objects use private interfaces into the Unix library

WineHQ Bugzilla wine-bugs at winehq.org
Sun Jan 10 06:38:19 CST 2021


https://bugs.winehq.org/show_bug.cgi?id=50292

Rémi Bernon <rbernon at codeweavers.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rbernon at codeweavers.com

--- Comment #1 from Rémi Bernon <rbernon at codeweavers.com> ---
Hi, I had a quick look at the patch series and here's a few nitpicks
that I've found:

> In 0004-ntdll-Implement-NtAlertThreadByThreadId-and-NtWaitFo.patch:
>
> +        if (teb->ClientId.UniqueThread == tid)
> +        {
> +            pthread_rwlock_unlock( &teb_list_lock );
> +            NtSetEvent( thread_data->tid_alert_event, NULL );
> +            return STATUS_SUCCESS;
> +        }

I think there's a race condition here, were the thread could potentially
be interrupted after the TEB lock is released, but before the event is
set.

The other thread that thread_data refers to may then terminate, the
NtSetEvent call may set an non-existing event, or worse if the TEB is
reused, and the new thread waiting itself, wake a wrong thread.

It's probably unlikely to happen but from a correctness point of view I
think it's wrong.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list