mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: [musl] vm lock needed in mprotect?
Date: Thu, 25 May 2023 18:53:19 +0200	[thread overview]
Message-ID: <ZG+Sfzr1ZK0FQ1W/@voyager> (raw)

Hi all,

I'm wondering if the vm lock is needed in mprotect(), similar to
munmap(). Reason for the vm lock was that if an application had two
threads waiting on a process-shared barrier, and one thread came out of
it to immediately unmap the SHM segment, then the other thread might not
yet have had a change to exit pthread_barrier_wait(), and since that
function accesses the barrier object after the last futex wait call, it
would crash.

So what if that first thread, instead of unmapping the SHM, just changes
its protection to read-only? That would also crash. Or is that somehow
not valid? If so, why?

Ciao,
Markus

             reply	other threads:[~2023-05-25 16:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 16:53 Markus Wichmann [this message]
2023-05-26  2:38 ` Rich Felker

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=ZG+Sfzr1ZK0FQ1W/@voyager \
    --to=nullplan@gmx.net \
    --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).