mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Valery Ushakov <uwe@stderr.spb.ru>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Re: Not sure how to debug this one.
Date: Mon, 19 Feb 2024 14:00:33 +0300	[thread overview]
Message-ID: <ZdM00UVZYqj_Hfgc@snips.stderr.spb.ru> (raw)
In-Reply-To: <20240218203306.GM4163@brightrain.aerifal.cx>

On Sun, Feb 18, 2024 at 15:33:06 -0500, Rich Felker wrote:

> > Restoring the context in siglongjmp should not be a problem per-se.
> > NetBSD libc does that and the example code doesn't crash there (quick
> > unscientific test on a ppc that I happen to have a terminal open on).
> > But then NetBSD libc doesn't bother to carefully factor that code to
> > minimize the need for MD asm.
> > 
> > Thanks, and sorry for the noise.
> 
> If you restore the signal mask from the returning context rather than
> in the returned-to context, there's always the possibility of stack
> overflow; in the worst case, this happens on the sigaltstack where
> you're specifically taking measures to avoid stack overflow being a
> fatal error. The test program is artificial, but the real-world way
> this would happen is getting a flood of signals like SIGINT or SIGTSTP
> or something coming in faster than you can respond to them, so that
> every time you try to return via siglongjmp, you actually consume
> another stack frame on the signal stack.
> 
> If NetBSD didn't crash, maybe it just has a much larger default stack
> size limit? Or maybe they reload sp before calling sigprocmask? That
> would work too, but the reason musl doesn't do it that way is that our
> setjmp/longjmp are compatible with an old ABI where there is no extra
> space in the jmp_buf for sigjmp_buf stuff.

As luck would have it, powerpc was doing the right thing.  We filed a
bug to fix the arches that don't.

Thanks!

-uwe

  reply	other threads:[~2024-02-19 11:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-17  1:48 [musl] " Rob Landley
2024-02-17  3:23 ` [musl] Re: [Toybox] " Mouse
2024-02-17 13:32   ` Rob Landley
2024-02-17 15:01     ` [musl] " Thorsten Glaser
2024-02-17 15:21     ` [musl] " Mouse
2024-02-17 17:02 ` [musl] " Rich Felker
2024-02-17 21:45 ` [musl] " Valery Ushakov
2024-02-17 23:09   ` Thorsten Glaser
2024-02-18 12:15     ` [musl] " Valery Ushakov
2024-02-18 22:51       ` [musl] " Thorsten Glaser
2024-02-18  1:34   ` Rich Felker
2024-02-18  1:40     ` Rich Felker
2024-02-18 12:55       ` Valery Ushakov
2024-02-18 14:33         ` Rich Felker
2024-02-18 15:06           ` Valery Ushakov
2024-02-18 20:33             ` Rich Felker
2024-02-19 11:00               ` Valery Ushakov [this message]
2024-02-19 17:54       ` Rob Landley
2024-02-19 23:05         ` Rich Felker
2024-02-18 12:47     ` Valery Ushakov
2024-02-19 13:12     ` Rob Landley

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=ZdM00UVZYqj_Hfgc@snips.stderr.spb.ru \
    --to=uwe@stderr.spb.ru \
    --cc=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).