mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Zhaohaifeng(Clark,IAS-SWP)" <zhaohaifeng4@huawei.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: [musl] A question about a patch of __vm_wait and thread list lock in musl
Date: Tue, 18 Oct 2022 12:49:27 +0000	[thread overview]
Message-ID: <b6315067bb404eb3b7d8defad4481a20@huawei.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

Hi there

I am reading the following patch, https://git.musl-libc.org/cgit/musl/commit/?id=d26e0774a59bb7245b205bc8e7d8b35cc2037095, it says that "the __vm_wait operation can delay forward progress arbitrarily long if a thread holding the lock is interrupted by a signal. in a worst case this can deadlock." So the patch puts the vm wait before the thread list lock.

I am wondering about the deadlock scenario. We guess the deadlock occurs like that one thread doing the pthread_exit holds the thread list lock and waits for the vm lock, and another thread holding the vm lock is interrupted by a signal and tries to hold the thread list lock in the signal handler.
But the thread list lock related functions are all AS-unsafe and shall not be called in signal hanlder. Further in musl before holding the thread list lock, the application signals are all blocked. So it seems the deadlock scenario does not exist.

Is my conclusion right?

BR
Clark Zhao

[-- Attachment #2: Type: text/html, Size: 3792 bytes --]

             reply	other threads:[~2022-10-18 12:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 12:49 Zhaohaifeng(Clark,IAS-SWP) [this message]
2022-10-18 13:28 ` Rich Felker
2022-10-19  8:15   ` 答复: " Zhaohaifeng(Clark,IAS-SWP)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6315067bb404eb3b7d8defad4481a20@huawei.com \
    --to=zhaohaifeng4@huawei.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).