mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [musl] Revisiting sigaltstack and implementation-internal signals
Date: Sun, 9 Aug 2020 20:26:32 -0400	[thread overview]
Message-ID: <20200810002632.GG3265@brightrain.aerifal.cx> (raw)
In-Reply-To: <1dff31ba-0e68-dca3-5cfc-22e254190799@dereferenced.org>

On Sun, Aug 09, 2020 at 06:10:02PM -0600, Ariadne Conill wrote:
> Hello,
> 
> On 2020-08-09 01:54, Markus Wichmann wrote:
> >On Sat, Aug 08, 2020 at 08:39:58PM -0400, Rich Felker wrote:
> >>on it (possibly not even any signal handlers installed), and (2)
> >>whether we should care about breaking code that swaps off of and back
> >>onto the alternate signal stack with swapcontext.
> >
> >Would anything bad happen in that case? I thought, when a signal handler
> >with SA_ONSTACK is invoked, the altstack is marked with SS_ONSTACK and
> >will not be reset until the signal handler returns. If the handler does
> >not return, and does not call sigaltstack(), then the SS_ONSTACK remains
> >set, and therefore further signals with SA_ONSTACK will be delivered on
> >the current stack. Otherwise, if a signal were to arrive while the
> >altstack is in use, it would overwrite the old stack.
> >
> >I cannot find a source code for swapcontext, but to my knowledge it
> >merely combines setjmp() and longjmp(), right? (setjmp() for the current
> >context and longjmp() for the other one). So no call to sigaltstack().
> 
> musl itself does not ship the ucontext.h functions, to get them
> users must install my libucontext library.
> 
> libucontext does not make use of setjmp/longjmp or sigaltstack.  For
> the most part we just provide a simple context-swapping
> implementation in assembly, except on POWER where we just wrap the
> SYS_swapcontext syscall.
> 
> So any behavior change with sigaltstack() should not effect
> libucontext behavior in theory.

The question is not about the behavior of the ucontext implementation
but of applications which use the API or do equivalent context-switch
things.

Rich

  reply	other threads:[~2020-08-10  0:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-09  0:39 Rich Felker
2020-08-09  7:54 ` Markus Wichmann
2020-08-10  0:06   ` Rich Felker
2020-08-10 16:34     ` Markus Wichmann
2020-08-10  0:10   ` Ariadne Conill
2020-08-10  0:26     ` Rich Felker [this message]
2020-08-10  0:28 ` Ariadne Conill
2020-08-10  8:15   ` Olaf Flebbe
2020-08-10 15:41     ` Szabolcs Nagy
2020-08-10 15:45       ` Olaf Flebbe
2020-08-10 16:24         ` Szabolcs Nagy
2020-08-10 16:27         ` Rich Felker
2020-08-10 16:36     ` Rich Felker
2020-08-10 16:57       ` Olaf Flebbe
2020-08-10 17:00         ` Rich Felker
2020-08-10 17:04           ` Olaf Flebbe
2020-08-10 18:32             ` Rich Felker
2020-08-10 19:29               ` Olaf Flebbe

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=20200810002632.GG3265@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --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).