mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jesse DeGuire <jesse.a.deguire@gmail.com>
To: musl@lists.openwall.com
Cc: Markus Wichmann <nullplan@gmx.net>
Subject: Re: [musl] Musl on Cortex-M Devices
Date: Mon, 21 Dec 2020 19:00:02 -0500	[thread overview]
Message-ID: <CALqyXLiXi5DVqWBaWCACd+KKM8VtZZ4tDKh=BRJzmMUNh52xgw@mail.gmail.com> (raw)
In-Reply-To: <20201218203444.GS534@brightrain.aerifal.cx>

On Fri, Dec 18, 2020 at 3:35 PM Rich Felker <dalias@libc.org> wrote:
>
> On Fri, Dec 18, 2020 at 08:38:49PM +0100, Markus Wichmann wrote:
> > On Wed, Dec 16, 2020 at 07:23:49PM -0500, Rich Felker wrote:
> > > On Wed, Dec 16, 2020 at 06:43:15PM -0500, Jesse DeGuire wrote:
> > > > diff --git a/src/thread/arm/__unmapself.s b/src/thread/arm/__unmapself..s
> > > > index 29c2d07b..fe0406e3 100644
> > > > --- a/src/thread/arm/__unmapself.s
> > > > +++ b/src/thread/arm/__unmapself.s
> > > > @@ -3,7 +3,7 @@
> > > >  .global __unmapself
> > > >  .type   __unmapself,%function
> > > >  __unmapself:
> > > > - mov r7,#91
> > > > + movs r7,#91
> > > >   svc 0
> > > > - mov r7,#1
> > > > + movs r7,#1
> > > >   svc 0
> > >
> > > OK, but this file can't be used on nommu anyway. Instead the generic C
> > > version has to be used.
> > >
> >
> > Speaking of that (C) version, maybe someone should note down somewhere
> > that it is only safe to call if simultaneous calls from other threads
> > are precluded somehow. That function uses global variables, so if
> > multiple threads call it at the same time, there will be blood (well,
> > there will be clobbering in any case). Which is fulfilled at the moment:
> > The only call site of __unmapself() is pthread_exit(), after getting the
> > thread list lock. That is a global lock, so further threads also
> > exitting would have to queue up there. But I think it is rather
> > non-intuitive that the thread-list lock happens to also protect the
> > global variables in __unmapself.c. And that is a property of the C
> > version not shared by the assembler versions, which are all thread-safe.
>
> Prior to commit 8f11e6127fe93093f81a52b15bb1537edc3fc8af,
> __unmapself.c had its own lock and had to explicitly modify the exit
> futex address to unlock that lock. Now it can (and must, since neither
> can be unlocked before the kernel-level task exits) share the thread
> list lock for this purpose.
>
> FWIW there's arguably no reason to even keep the asm versions of this
> function now that the thread list lock exists. We could just remove
> them all.

Should I just go ahead and remove this so the generic C version is
used instead since I'm already here?

-Jesse

  reply	other threads:[~2020-12-22  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 23:43 Jesse DeGuire
2020-12-17  0:23 ` Rich Felker
2020-12-17  4:55   ` Patrick Oppenlander
2020-12-17  5:10     ` Patrick Oppenlander
2020-12-18  7:17       ` Jesse DeGuire
2020-12-22 21:43         ` Patrick Oppenlander
2021-01-06  3:24           ` Jesse DeGuire
2021-01-06  4:01             ` Patrick Oppenlander
2021-01-13 23:51               ` Jesse DeGuire
2020-12-18  7:15   ` Jesse DeGuire
2020-12-18 17:30     ` Rich Felker
2020-12-21 23:58       ` Jesse DeGuire
2020-12-22  1:39         ` Rich Felker
2020-12-18 19:38   ` Markus Wichmann
2020-12-18 20:34     ` Rich Felker
2020-12-22  0:00       ` Jesse DeGuire [this message]
2020-12-22  1:40         ` 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='CALqyXLiXi5DVqWBaWCACd+KKM8VtZZ4tDKh=BRJzmMUNh52xgw@mail.gmail.com' \
    --to=jesse.a.deguire@gmail.com \
    --cc=musl@lists.openwall.com \
    --cc=nullplan@gmx.net \
    /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).