RFC: Update MINSIGSTKSZ and SIGSTKSZ
H.J. Lu
hjl.tools@gmail.com
Tue Sep 29 21:07:45 GMT 2020
On Tue, Sep 29, 2020 at 1:18 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
>
> On 9/29/20 7:10 AM, H.J. Lu via Libc-alpha wrote:
> > Some softwares must be updated for this change. On the other hand,
> > they may not work correctly on the newer processors in any case
>
> A lot of software will continue to work if SIGSTKSZ continues to be a constant
> that is "too small" for the architecture. For example, Gnulib lib/c-stack.c does
Currently, SIGSTKSZ is 8KB. We will have CPUs which require more than 8KB
signal stake size in the very near future.
> the following, and this should be fine on practical platforms with small-stack
> signal handlers:
>
> static union
> {
> char buffer[SIGSTKSZ];
> max_align_t align;
> } alternate_signal_stack;
> ...
> stack_t st;
> st.ss_flags = 0;
> st.ss_sp = alternate_signal_stack.buffer;
> st.ss_size = sizeof alternate_signal_stack.buffer;
This should be changed to malloc or mmap now.
> int r = sigaltstack (&st, NULL);
> if (r != 0)
> return r;
>
> MINSIGSTKSZ is another matter but far less software uses MINSIGSTKSZ, I'd guess.
--
H.J.
More information about the Libc-alpha
mailing list