public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: shwaresyst <shwaresyst@aol.com>
To: eblake@redhat.com, bruno@clisp.org, cbouchar@redhat.com,
	bug-m4@gnu.org,  libc-alpha@sourceware.org,
	austin-group-l@opengroup.org
Subject: Re: SIGSTKSZ is now a run-time variable
Date: Tue, 9 Mar 2021 16:14:31 +0000 (UTC)	[thread overview]
Message-ID: <832918739.1734727.1615306471320@mail.yahoo.com> (raw)
In-Reply-To: <832918739.1734727.1615306471320.ref@mail.yahoo.com>


To me that looks like a conformance violation and should be reverted. There is no _SC_SIGSTKSZ defined in <unistd.h> by the standard, to begin with, so that use of sysconf() is a non-portable extension on its own.

I could see the definition of SIGSTKSZ being changed to the static minimum a particular processor requires, or is initially allocated as a 'safe' amount, rather than static "default size", and moving SIGSTKSZ to <limits.h>. This would contrast to MINSIGSTKSZ as the lowest value for a platform for all supported processors. Then an application could use sysconf() to query for the maximum size the configuration supports if it wants to use more than that, as a runtime increasable limit.
On Tuesday, March 9, 2021 Eric Blake via austin-group-l at The Open Group <eblake@redhat.com> wrote:
[adding glibc and Austin group lists]

On 3/6/21 12:50 PM, Bruno Haible wrote:
> Hi,
> 
> Carol Bouchard wrote in <https://lists.gnu.org/archive/html/bug-m4/2021-03/msg00000.html>:
>> A change that was introduced is the
>> #define SIGSTKSZ is no longer a statically defined variable.  It's value can
>> only be determined at run time.
>>
>> # define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
> 
> This is invalid. POSIX:2018 [1] defines two lists of macros:
> 
>  1) "The <signal.h> header shall define the following macros which shall
>      expand to integer constant expressions that need not be usable in
>      #if preprocessing directives:"
> 
>  2) "The <signal.h> header shall also define the following symbolic constants:"
> 
> SIGSTKSZ is in the second list. This implies that it must expand to a constant
> and that it must be usable in #if preprocessing directives.

The question becomes whether glibc is in violation of POSIX for having
made the change, or whether POSIX needs to be amended to allow SIGSTKSZ
to be non-preprocessor-safe and/or non-constant.

> 
> Besides being invalid, it is also not needed. The alternate signal stack
> needs to be dimensioned according to the CPU and ABI that is in use. For example,
> SPARC processors tend to use much more stack space than x86 per function
> invocation. Similarly, 64-bit execution on a bi-arch CPU tends to use more stack
> space than 32-bit execution, because return addresses and other pointers are
> 64-bit vs. 32-bit large. But once you have fixed the CPU and the ABI, there is
> no ambiguity any more.
> 
>> This affects m4 code since the code assumes a statically defined variable which
>> can be determined at preprocessor time.
> 
> POSIX guarantees this assumption.
> 
>> Please advise how I can get past this.
> 
> Fix your <signal.h>.

https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=6c57d320484988e87e446e2e60ce42816bf51d53
shows where glibc made the change, and I've now seen reports of several
projects failing to build when using glibc with this change included.

> 
> Bruno
> 
> [1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
> 
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.          +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


       reply	other threads:[~2021-03-09 16:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <832918739.1734727.1615306471320.ref@mail.yahoo.com>
2021-03-09 16:14 ` shwaresyst [this message]
2021-03-09 19:33   ` Paul Eggert
2021-03-09 19:34   ` Eric Blake
2021-03-09 20:12     ` Eric Blake
     [not found] <1569476484.1894162.1615325397167.ref@mail.yahoo.com>
2021-03-09 21:29 ` shwaresyst
2021-03-09 23:58   ` H.J. Lu
     [not found] <1841269.IEpri3ZHvQ@omega>
2021-03-09 15:23 ` Eric Blake
2021-03-09 15:26   ` Andreas Schwab
2021-03-09 15:48     ` Eric Blake
2021-03-09 19:58       ` Bruno Haible
2021-03-09 21:05         ` H.J. Lu
     [not found]         ` <20210309211735.GW19922@dragon.sl.home>
2021-03-16 19:46           ` Carol Bouchard
2021-03-26 12:46             ` Carol Bouchard
2021-03-09 15:46   ` Zack Weinberg

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=832918739.1734727.1615306471320@mail.yahoo.com \
    --to=shwaresyst@aol.com \
    --cc=austin-group-l@opengroup.org \
    --cc=bruno@clisp.org \
    --cc=bug-m4@gnu.org \
    --cc=cbouchar@redhat.com \
    --cc=eblake@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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).