mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Markus Wichmann <nullplan@gmx.net>
Cc: musl@lists.openwall.com
Subject: Re: [musl] add noexcept to all functions please
Date: Mon, 08 Nov 2021 09:30:03 +0100	[thread overview]
Message-ID: <87bl2vnj78.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20211107195601.GA2713@voyager> (Markus Wichmann's message of "Sun, 7 Nov 2021 20:56:01 +0100")

* Markus Wichmann:

> On Sun, Nov 07, 2021 at 07:20:21PM +0100, Florian Weimer wrote:
>> I believe the musl cancellation implementation does not use DWARF
>> unwinding.  I do not know if it cancellation handlers have the same
>> hardening gap as glibc's with setjmp-based unwinding.

> I presume you mean the cancel cleanup handling. In that case, musl uses
> a simple linked list, with nodes allocated on stack. No gaps of any
> kind.

The __f function pointer is stored in the node on the stack, along with
the __x argument that is passed by _pthread_cleanup_pop.  This looks
like a convenient on-stack gadget for exploitation purposes.  In musl,
the invocation is in the library itself, so there isn't much choice
there.  In glibc, with -fno-exceptions, we try to avoid this by inlining
the non-cancellation path at the pthread_cleanup_pop point.  But even if
the function pointer is constant, current GCC is no longer able to
produce a direct call.  But with -fexceptions, we do get a direct call.

Thanks,
Florian


      reply	other threads:[~2021-11-08  8:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-06 17:15 sotrdg sotrdg
2021-11-06 18:28 ` Jon Chesterfield
2021-11-06 18:39   ` Joakim Sindholt
2021-11-07 17:37     ` James Y Knight
2021-11-07 18:20       ` Florian Weimer
2021-11-07 19:56         ` Markus Wichmann
2021-11-08  8:30           ` Florian Weimer [this message]

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=87bl2vnj78.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.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).