[PATCH] Tests for minimal signal handler functionality in MINSIGSTKSZ space.

Zack Weinberg zackw@panix.com
Wed Jan 16 14:06:00 GMT 2019


The patch I just pushed is attached to this message.  Thanks for the
quick reviews.  A couple of notes:

> I'm not sure if it's explicitly spelled out that the default disposition
> for SIGABRT is to core

This is indeed specified in POSIX, see the table of default signal actions in
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html .

> +/* C2011 7.4.1.1p5 specifies that only the following operations are
> +   guaranteed to be well-defined inside an asynchronous signal handler:
> ...
> +     * calling abort, _Exit, quick_exit, or signal
> +       * signal may only be called with its first argument equal to the
> +         number of the signal that caused the handler to be called

It occurred to me this morning that signal is implemented using
sigaction, and a 'struct sigaction' is 152 bytes on x86-64 (because of
the sigset_t).  Normally that's nothing to worry about, but when
there's only 2048 bytes of stack in total and the kernel has filled
more than half of that with ucontext data, it _could_ be a problem.
I left the test as is for now, but I suggest that if it does crash on
any architecture we should drop that part of tst-minsigstksz-1.c
without hesitation.

It also occurs to me that on some architectures MINSIGSTKSZ is less
than a page; on those architectures, the rounding done in xsigstack.c
means we aren't _really_ testing this stuff in MINSIGSTKSZ space.
Since overflow is much more of a concern than underflow, what do
people think of adjusting the code in xsigstack.c so that the area
actually passed to sigaltstack will not be rounded and will be right
up against the guard in the direction of overflow?  This would mean
xsigstack.c has to know which direction the stack grows, but I think
we already have internal macros for that, so it's not a huge problem.
I would do this as a follow-up patch if it's agreed to be a good idea.

zw
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Tests-for-minimal-signal-handler-functionality-in-MI.patch
Type: text/x-patch
Size: 25989 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20190116/28af485a/attachment.bin>


More information about the Libc-alpha mailing list