mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: [PATCH] Fix the use of sigaltstack to return to the saved main stack.
Date: Wed, 10 Jul 2019 23:23:19 +0200	[thread overview]
Message-ID: <20190710212319.GM21055@port70.net> (raw)
In-Reply-To: <CAA2zVHrijyMnrUef5XUqRKX+H0QOwugRmk+gJOgPLvbxJ78=9g@mail.gmail.com>

* James Y Knight <jyknight@google.com> [2019-07-10 16:11:23 -0400]:
>  int sigaltstack(const stack_t *restrict ss, stack_t *restrict old)
>  {
> +	// We must check requirements which Linux fails to verify in the syscall
> +	// itself.
>  	if (ss) {
> -		if (ss->ss_size < MINSIGSTKSZ) {
> +		// The syscall does already check against MINSIGSTKSZ, however,
> +		// the kernel's value is smaller than musl's value on some
> +		// architectures. Thus, although this check may appear
> +		// redundant, it is not.

the comment does not make sense to me, the check is obviously
not redundant.

MINSIGSTKSZ is a libc api, has nothing to do with the kernel

the kernel also defines a MINSIGSZTKSZ but musl is an
abstraction layer higher, the linux limit should not be
observable to users, only the limit defined by musl,
which ensures not only that the kernel can deliver a
signal but also reserves space of any current or future
hackery the c runtime may need to do around signal handling,
so that trivial c language signal handler is guaranteed
to work.

this is the only reasonable way to make such limit useful.
if it were only a kernel limit, then application code would
have to guess the libc signal handling overhead and add that
to the MINSIGSZTKSZ when allocating signal stacks.


  reply	other threads:[~2019-07-10 21:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 19:01 James Y Knight
2019-07-09 19:30 ` Rich Felker
2019-07-10 18:04   ` James Y Knight
2019-07-10 18:39     ` Rich Felker
2019-07-10 20:11       ` James Y Knight
2019-07-10 21:23         ` Szabolcs Nagy [this message]
2019-07-10 21:48           ` Rich Felker
2019-07-11 15:51             ` James Y Knight
2019-07-12  9:18           ` Florian Weimer
2019-07-12 16:06             ` 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=20190710212319.GM21055@port70.net \
    --to=nsz@port70.net \
    --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).