bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: bug-gnulib@gnu.org, Eric Blake <eblake@redhat.com>
Subject: Re: sigsegv, c-stack: Avoid compilation error with glibc >= 2.34
Date: Mon, 24 May 2021 12:37:12 +0200	[thread overview]
Message-ID: <6817661.3gVJk7oQnW@omega> (raw)
In-Reply-To: <2a157ddd-dbe9-125e-caa9-5833441a2a73@cs.ucla.edu>

Paul Eggert wrote:
> Thanks, that looks good except please change "create nested functions" 
> to "create and then use nested functions", as it's OK to for a 
> stack-overflow handler to create a nested function without using it.

Yup. I had a thinko there.

> Should a similar restriction be documented for libsigsegv, or is that 
> library immune to this problem?

Right, it will need to be documented for libsigsegv as well.


2021-05-24  Bruno Haible  <bruno@clisp.org>

	c-stack: Document another restriction.
	Triggered by a discussion with Paul Eggert.
	* lib/c-stack.h: Mention that ACTION should not use nested functions.

diff --git a/lib/c-stack.h b/lib/c-stack.h
index 56d74f1..a9a8b13 100644
--- a/lib/c-stack.h
+++ b/lib/c-stack.h
@@ -33,10 +33,15 @@
 
    A null ACTION acts like an action that does nothing.
 
-   ACTION must be async-signal-safe.  ACTION together with its callees
-   must not require more than 64 KiB of stack space.  Also,
-   ACTION should not call longjmp, because this implementation does
-   not guarantee that it is safe to return to the original stack.
+   Restrictions:
+   - ACTION must be async-signal-safe.
+   - ACTION together with its callees must not require more than 64 KiB of
+     stack space.
+   - ACTION must not create and then invoke nested functions
+     <https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html>, because
+     this implementation does not guarantee an executable stack.
+   - ACTION should not call longjmp, because this implementation does not
+     guarantee that it is safe to return to the original stack.
 
    This function may install a handler for the SIGSEGV signal or for the SIGBUS
    signal or exercise other system dependent exception handling APIs.  */



  reply	other threads:[~2021-05-24 10:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17  0:33 sigsegv, c-stack: Avoid compilation error with glibc >= 2.34 Bruno Haible
2021-05-17  2:45 ` Paul Eggert
2021-05-18 17:34   ` Bruno Haible
2021-05-21 22:49     ` Paul Eggert
2021-05-22 22:59       ` Bruno Haible
2021-05-23  5:12         ` Paul Eggert
2021-05-23 12:14           ` Bruno Haible
2021-05-24  2:40             ` Paul Eggert
2021-05-24 10:37               ` Bruno Haible [this message]
2021-05-23  0:00       ` sigsegv.h interface Bruno Haible
2021-05-23  5:14         ` Paul Eggert

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6817661.3gVJk7oQnW@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eblake@redhat.com \
    --cc=eggert@cs.ucla.edu \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).