* [PATCH] support: Replace MINSIGSTKSZ with sysconf (_SC_MINSIGSTKSZ)
@ 2021-07-09 21:38 H.J. Lu via Libc-alpha
2021-07-09 22:10 ` Carlos O'Donell via Libc-alpha
0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu via Libc-alpha @ 2021-07-09 21:38 UTC (permalink / raw)
To: libc-alpha
Replace MINSIGSTKSZ with sysconf (_SC_MINSIGSTKSZ) since the constant
MINSIGSTKSZ used in glibc build may be too small.
---
support/support_stack_alloc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/support/support_stack_alloc.c b/support/support_stack_alloc.c
index 03494dd185..b05ae08968 100644
--- a/support/support_stack_alloc.c
+++ b/support/support_stack_alloc.c
@@ -39,10 +39,11 @@ support_stack_alloc (size_t size)
if (pagesize == -1)
FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n");
- /* Always supply at least MINSIGSTKSZ space; passing 0 as size means
- only that much space. No matter what the number is, round it up
- to a whole number of pages. */
- size_t stacksize = roundup (size + MINSIGSTKSZ, pagesize);
+ /* Always supply at least sysconf (_SC_MINSIGSTKSZ) space; passing 0
+ as size means only that much space. No matter what the number is,
+ round it up to a whole number of pages. */
+ size_t stacksize = roundup (size + sysconf (_SC_MINSIGSTKSZ),
+ pagesize);
/* The guard bands need to be large enough to intercept offset
accesses from a stack address that might otherwise hit another
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] support: Replace MINSIGSTKSZ with sysconf (_SC_MINSIGSTKSZ)
2021-07-09 21:38 [PATCH] support: Replace MINSIGSTKSZ with sysconf (_SC_MINSIGSTKSZ) H.J. Lu via Libc-alpha
@ 2021-07-09 22:10 ` Carlos O'Donell via Libc-alpha
2021-07-10 18:10 ` [PATCH] support: Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ H.J. Lu via Libc-alpha
0 siblings, 1 reply; 4+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2021-07-09 22:10 UTC (permalink / raw)
To: H.J. Lu, libc-alpha
On 7/9/21 5:38 PM, H.J. Lu via Libc-alpha wrote:
> Replace MINSIGSTKSZ with sysconf (_SC_MINSIGSTKSZ) since the constant
> MINSIGSTKSZ used in glibc build may be too small.
LGTM. It's good to explicitly convert to using sysconf in support/* code.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> ---
> support/support_stack_alloc.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/support/support_stack_alloc.c b/support/support_stack_alloc.c
> index 03494dd185..b05ae08968 100644
> --- a/support/support_stack_alloc.c
> +++ b/support/support_stack_alloc.c
> @@ -39,10 +39,11 @@ support_stack_alloc (size_t size)
> if (pagesize == -1)
> FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n");
>
> - /* Always supply at least MINSIGSTKSZ space; passing 0 as size means
> - only that much space. No matter what the number is, round it up
> - to a whole number of pages. */
> - size_t stacksize = roundup (size + MINSIGSTKSZ, pagesize);
> + /* Always supply at least sysconf (_SC_MINSIGSTKSZ) space; passing 0
> + as size means only that much space. No matter what the number is,
> + round it up to a whole number of pages. */
> + size_t stacksize = roundup (size + sysconf (_SC_MINSIGSTKSZ),
> + pagesize);
>
> /* The guard bands need to be large enough to intercept offset
> accesses from a stack address that might otherwise hit another
>
--
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] support: Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ
2021-07-09 22:10 ` Carlos O'Donell via Libc-alpha
@ 2021-07-10 18:10 ` H.J. Lu via Libc-alpha
2021-07-11 14:44 ` Carlos O'Donell via Libc-alpha
0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu via Libc-alpha @ 2021-07-10 18:10 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: GNU C Library
[-- Attachment #1: Type: text/plain, Size: 1823 bytes --]
On Fri, Jul 9, 2021 at 3:10 PM Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 7/9/21 5:38 PM, H.J. Lu via Libc-alpha wrote:
> > Replace MINSIGSTKSZ with sysconf (_SC_MINSIGSTKSZ) since the constant
> > MINSIGSTKSZ used in glibc build may be too small.
>
> LGTM. It's good to explicitly convert to using sysconf in support/* code.
I used the wrong _SC_XXX. _SC_MINSIGSTKSZ is for the empty
signal handler. sysconf (_SC_SIGSTKSZ) returns the suggested
minimum number of bytes of stack space required for a signal stack.
OK for master?
> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
>
> > ---
> > support/support_stack_alloc.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/support/support_stack_alloc.c b/support/support_stack_alloc.c
> > index 03494dd185..b05ae08968 100644
> > --- a/support/support_stack_alloc.c
> > +++ b/support/support_stack_alloc.c
> > @@ -39,10 +39,11 @@ support_stack_alloc (size_t size)
> > if (pagesize == -1)
> > FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n");
> >
> > - /* Always supply at least MINSIGSTKSZ space; passing 0 as size means
> > - only that much space. No matter what the number is, round it up
> > - to a whole number of pages. */
> > - size_t stacksize = roundup (size + MINSIGSTKSZ, pagesize);
> > + /* Always supply at least sysconf (_SC_MINSIGSTKSZ) space; passing 0
> > + as size means only that much space. No matter what the number is,
> > + round it up to a whole number of pages. */
> > + size_t stacksize = roundup (size + sysconf (_SC_MINSIGSTKSZ),
> > + pagesize);
> >
> > /* The guard bands need to be large enough to intercept offset
> > accesses from a stack address that might otherwise hit another
> >
>
>
> --
> Cheers,
> Carlos.
>
--
H.J.
[-- Attachment #2: 0001-support-Replace-_SC_MINSIGSTKSZ-with-_SC_SIGSTKSZ.patch --]
[-- Type: text/x-patch, Size: 1480 bytes --]
From 1b30a2708f2bc8a7161c19737ac5f5927803ffc9 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 10 Jul 2021 10:56:50 -0700
Subject: [PATCH] support: Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ
Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ since sysconf (_SC_MINSIGSTKSZ)
returns 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 while sysconf (_SC_SIGSTKSZ) returns the
suggested minimum number of bytes of stack space required for a signal
stack.
---
support/support_stack_alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/support/support_stack_alloc.c b/support/support_stack_alloc.c
index b05ae08968..62eee84573 100644
--- a/support/support_stack_alloc.c
+++ b/support/support_stack_alloc.c
@@ -39,10 +39,10 @@ support_stack_alloc (size_t size)
if (pagesize == -1)
FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n");
- /* Always supply at least sysconf (_SC_MINSIGSTKSZ) space; passing 0
+ /* Always supply at least sysconf (_SC_SIGSTKSZ) space; passing 0
as size means only that much space. No matter what the number is,
round it up to a whole number of pages. */
- size_t stacksize = roundup (size + sysconf (_SC_MINSIGSTKSZ),
+ size_t stacksize = roundup (size + sysconf (_SC_SIGSTKSZ),
pagesize);
/* The guard bands need to be large enough to intercept offset
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] support: Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ
2021-07-10 18:10 ` [PATCH] support: Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ H.J. Lu via Libc-alpha
@ 2021-07-11 14:44 ` Carlos O'Donell via Libc-alpha
0 siblings, 0 replies; 4+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2021-07-11 14:44 UTC (permalink / raw)
To: H.J. Lu; +Cc: GNU C Library
On 7/10/21 2:10 PM, H.J. Lu wrote:
> On Fri, Jul 9, 2021 at 3:10 PM Carlos O'Donell <carlos@redhat.com> wrote:
>>
>> On 7/9/21 5:38 PM, H.J. Lu via Libc-alpha wrote:
>>> Replace MINSIGSTKSZ with sysconf (_SC_MINSIGSTKSZ) since the constant
>>> MINSIGSTKSZ used in glibc build may be too small.
>>
>> LGTM. It's good to explicitly convert to using sysconf in support/* code.
>
> I used the wrong _SC_XXX. _SC_MINSIGSTKSZ is for the empty
> signal handler. sysconf (_SC_SIGSTKSZ) returns the suggested
> minimum number of bytes of stack space required for a signal stack.
>
> OK for master?
LGTM. This still goes in the right direction, even if we need more stack
space for testing.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> From 1b30a2708f2bc8a7161c19737ac5f5927803ffc9 Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.tools@gmail.com>
> Date: Sat, 10 Jul 2021 10:56:50 -0700
> Subject: [PATCH] support: Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ
>
> Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ since sysconf (_SC_MINSIGSTKSZ)
> returns 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 while sysconf (_SC_SIGSTKSZ) returns the
> suggested minimum number of bytes of stack space required for a signal
> stack.
> ---
> support/support_stack_alloc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/support/support_stack_alloc.c b/support/support_stack_alloc.c
> index b05ae08968..62eee84573 100644
> --- a/support/support_stack_alloc.c
> +++ b/support/support_stack_alloc.c
> @@ -39,10 +39,10 @@ support_stack_alloc (size_t size)
> if (pagesize == -1)
> FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n");
>
> - /* Always supply at least sysconf (_SC_MINSIGSTKSZ) space; passing 0
> + /* Always supply at least sysconf (_SC_SIGSTKSZ) space; passing 0
> as size means only that much space. No matter what the number is,
> round it up to a whole number of pages. */
> - size_t stacksize = roundup (size + sysconf (_SC_MINSIGSTKSZ),
> + size_t stacksize = roundup (size + sysconf (_SC_SIGSTKSZ),
> pagesize);
>
> /* The guard bands need to be large enough to intercept offset
> --
> 2.31.1
>
--
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-11 14:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 21:38 [PATCH] support: Replace MINSIGSTKSZ with sysconf (_SC_MINSIGSTKSZ) H.J. Lu via Libc-alpha
2021-07-09 22:10 ` Carlos O'Donell via Libc-alpha
2021-07-10 18:10 ` [PATCH] support: Replace _SC_MINSIGSTKSZ with _SC_SIGSTKSZ H.J. Lu via Libc-alpha
2021-07-11 14:44 ` Carlos O'Donell via Libc-alpha
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).