public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Rajalakshmi Srinivasaraghavan <rajis@linux.vnet.ibm.com>
Cc: Manjunath S Matti <mmatti@linux.vnet.ibm.com>,
	 Tulio Magno Quites Machado Filho <tuliom@ascii.art.br>,
	 Manjunath Matti via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH] powerpc: Use sysconf (_SC_SIGSTKSZ) to set SIGSTKSZ and MINSIGSTKSZ.
Date: Wed, 17 May 2023 16:09:07 -0700	[thread overview]
Message-ID: <CAMe9rOo9a9jrdD=+EmNmaEhhio9Cu+bQRqTubk1voRSoAi_2sg@mail.gmail.com> (raw)
In-Reply-To: <b0410a2c-b794-d9d0-587d-8e5ab90d6877@linux.vnet.ibm.com>

On Wed, May 17, 2023 at 3:18 PM Rajalakshmi Srinivasaraghavan
<rajis@linux.vnet.ibm.com> wrote:
>
>
> On 5/11/23 11:50 AM, Manjunath S Matti wrote:
>
>
> On 09/05/23 11:03 pm, Tulio Magno Quites Machado Filho wrote:
>
> Manjunath S Matti <mmatti@linux.vnet.ibm.com> writes:
>
> Am I missing some thing, please help me understand the file
>
> No. You're right.
> The issue I hypothesized can't happen.
>
> Thanks for confirming.
>
> The patch looks good.
>
> I will definitely add a testcases just to check what value are we getting
>
> from the kernel.
>
> I'm sorry, I'm not sure this test is needed anymore.
> While it doesn't hurt to have it, it would add little value.
>
> Thanks again!
>
> I have one last thing that I fail to understand, in x86
>
> file: sysdeps/unix/sysv/linux/bits/sigstksz.h
>
>  26 /* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ).  */
>  27 # undef SIGSTKSZ
>  28 # define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
>  29
>  30 /* Minimum stack size for a signal handler: SIGSTKSZ.  */
>  31 # undef MINSIGSTKSZ
>  32 # define MINSIGSTKSZ SIGSTKSZ
>
> line number 32, both MINSIGSTKSZ and SIGSTKSZ are intentionally set to the same value.
>
> Do you know why, I just wanted to know the reason behind this.
>
>
> This was added by commit 6c57d320484988e87e446e2e60ce42816bf51d53.
>
> @H.J. Lu Do you have any comments on this question?
>

There are

@item _SC_MINSIGSTKSZ
@standards{GNU, unistd.h}
Inquire about the minimum number of bytes of free stack space required
in order to guarantee successful, non-nested handling of a single signal
whose handler is an empty function.

@item _SC_SIGSTKSZ
@standards{GNU, unistd.h}
Inquire about the suggested minimum number of bytes of stack space
required for a signal stack.

This is not guaranteed to be enough for any specific purpose other than
the invocation of a single, non-nested, empty handler, but nonetheless
should be enough for basic scenarios involving simple signal handlers
and very low levels of signal nesting (say, 2 or 3 levels at the very
most).

This value is provided for developer convenience and to ease migration
from the legacy @code{SIGSTKSZ} constant.  Programs requiring stronger
guarantees should avoid using it if at all possible.

@vtable @code
@item SIGSTKSZ
This is the canonical size for a signal stack.  It is judged to be
sufficient for normal uses.

@item MINSIGSTKSZ
This is the amount of signal stack space the operating system needs just
to implement signal delivery.  The size of a signal stack @strong{must}
be greater than this.

For most cases, just using @code{SIGSTKSZ} for @code{ss_size} is
sufficient.  But if you know how much stack space your program's signal
handlers will need, you may want to use a different size.  In this case,
you should allocate @code{MINSIGSTKSZ} additional bytes for the signal
stack and increase @code{ss_size} accordingly.

Since sysconf (_SC_SIGSTKSZ) is the suggested minimum signal stack size,
it is used for both SIGSTKSZ and MINSIGSTKSZ.


-- 
H.J.

  reply	other threads:[~2023-05-17 23:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 10:52 Manjunath Matti
2023-04-28 18:05 ` Tulio Magno Quites Machado Filho
2023-05-03 16:12   ` Manjunath S Matti
2023-05-03 17:48     ` Tulio Magno Quites Machado Filho
2023-05-05 10:15       ` Manjunath S Matti
2023-05-05 14:14         ` Tulio Magno Quites Machado Filho
2023-05-09 12:24           ` Manjunath S Matti
2023-05-09 17:33             ` Tulio Magno Quites Machado Filho
2023-05-11 16:50               ` Manjunath S Matti
2023-05-17 22:18                 ` Rajalakshmi Srinivasaraghavan
2023-05-17 23:09                   ` H.J. Lu [this message]
2023-05-16 11:11 Manjunath Matti
2023-05-24 19:08 ` Florian Weimer
2023-06-23 12:01   ` Manjunath S Matti

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='CAMe9rOo9a9jrdD=+EmNmaEhhio9Cu+bQRqTubk1voRSoAi_2sg@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=mmatti@linux.vnet.ibm.com \
    --cc=rajis@linux.vnet.ibm.com \
    --cc=tuliom@ascii.art.br \
    /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).