[PATCH v6] eal/unix: fix thread creation

David Marchand david.marchand at redhat.com
Sat Mar 18 19:26:34 CET 2023


On Fri, Mar 17, 2023 at 7:52 PM David Marchand
<david.marchand at redhat.com> wrote:
>
> From: Tyler Retzlaff <roretzla at linux.microsoft.com>
>
> In rte_thread_create setting affinity after pthread_create may fail.
> Such a failure should result in the entire rte_thread_create failing
> but doesn't.
>
> Additionally if there is a failure to set affinity a race exists where
> the creating thread will free ctx and depending on scheduling of the new
> thread it may also free ctx (double free).
>
> Resolve the above by setting the affinity from the newly created thread
> using a condition variable to signal the completion of the thread
> start wrapper having completed.
>
> Since we are now waiting for the thread start wrapper to complete we can
> allocate the thread start wrapper context on the stack. While here clean
> up the variable naming in the context to better highlight the fields of
> the context require synchronization between the creating and created
> thread.
>
> Fixes: ce6e911d20f6 ("eal: add thread lifetime API")
> Cc: stable at dpdk.org
>
> Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> Signed-off-by: David Marchand <david.marchand at redhat.com>

Applied thanks.


-- 
David Marchand



More information about the stable mailing list