Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 20 Jul 2023 13:53:11 +0000
From: changdiankang <changdiankang@...wei.com>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: [PATCH] set tid address in fork

In pthrad_exit the exiting thread will hold the thread list lock,
and will unlock it in kernel by clear the tid address &__thread_list_lock.

A thread created by pthrad_create is created with clone syscall with
CLONE_CHILD_CLEARTID flag and &__thread_list_lock as child_tid
parameter. When the thread exits, the thread list lock can be woke up
(see man clone CLONE_CHILD_CLEARTID).

But in fork, the main thread is created with fork syscall or with
clone syscall without CLONE_CHILD_CLEARTID flag. The &__thread_list_lock
is not be set to tid address. So when the main thread exits, the thread
list lock can't be woke up by kernel. This may lead some problems when
other child threads try to hold this lock. For example, a child thread
blocks at waiting thread list lock when joining the main thread.

To fix this issue, we should set &__thread_list_lock to the main thread tid
address in fork.

Download attachment "0001-set-tid-address-in-fork.patch" of type "application/octet-stream" (1685 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.