mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Leonid Shamis <leonid.shamis@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Robust mutex returning ESRCH
Date: Tue, 29 Sep 2020 14:48:05 -0400	[thread overview]
Message-ID: <20200929184803.GF17637@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAHSMefinBKvwuWOei+uvF3OUafR-qrCJ471vituvBbDd=W-o3A@mail.gmail.com>

On Tue, Sep 29, 2020 at 09:31:12AM -0700, Leonid Shamis wrote:
> We had a bug in our code where a dying process released shared memory
> (munmap) prior to exit. The process held ownership of a robust mutex within
> the shared memory, and because the address was unmapped, the robust_list
> wasn't able to set the appropriate flags.
> 
> The next attempt to lock the mutex, in another process, returned ESRCH.
> 
> Should ESRCH be caughtand converted to either a recoverable EOWNERDEAD or
> ENOTRECOVERABLE?

Was it also priority-inheritance? Otherwise I don't see where ESRCH
should have come from. Unmapping the mutex while you hold is should
almost surely be treated as undefined (though I don't think the
standard spells this out explicitly anywhere). It probably would be
nice to avoid returning a bogus error code to the non-erroneous caller
sharing the robust mutex with a program that has UB, but I don't think
Linux admits any efficient general solution here.

Rich

  reply	other threads:[~2020-09-29 18:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 16:31 Leonid Shamis
2020-09-29 18:48 ` Rich Felker [this message]
2020-09-29 19:02   ` Leonid Shamis
2020-09-29 19:28     ` 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=20200929184803.GF17637@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=leonid.shamis@gmail.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).