diff options
author | Zack Weinberg <zackw@panix.com> | 2019-01-15 14:58:15 -0500 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2019-01-16 09:04:10 -0500 |
commit | fbbc9a4e347dabb2d1662744e6a2e83b569ea3a4 (patch) | |
tree | 851cec767738b1312c091946390c7652b7a8e224 /support/xsignal.h | |
parent | 5f1135e4e5a16c0a197ff8f82e5bb65aef468bd7 (diff) | |
download | glibc-fbbc9a4e347dabb2d1662744e6a2e83b569ea3a4.zip glibc-fbbc9a4e347dabb2d1662744e6a2e83b569ea3a4.tar.gz glibc-fbbc9a4e347dabb2d1662744e6a2e83b569ea3a4.tar.bz2 |
Tests for minimal signal handler functionality in MINSIGSTKSZ space.
There is general agreement that the very short list of things that ISO
C says you can do in an async signal handler should all work when the
handler is running on an alternate signal stack with only MINSIGSTKSZ
space. This patch adds tests to make sure those things do work.
To facilitate this, there is a new set of test support routines for
setting up alternate signal stacks; see support/xsignal.h for the API.
* support/xsignal.h (xalloc_sigstack, xfree_sigstack)
(xget_sigstack_location): New test support functions.
* support/xsigstack.c: New file, implementing them.
* support/tst-xsigstack.c: New test for them.
* support/Makefile: Update.
* signal/tst-minsigstksz-1.c
* signal/tst-minsigstksz-2.c
* signal/tst-minsigstksz-3.c
* signal/tst-minsigstksz-3a.c
* signal/tst-minsigstksz-4.c: New tests.
* signal/Makefile: Run them.
Diffstat (limited to 'support/xsignal.h')
-rw-r--r-- | support/xsignal.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/support/xsignal.h b/support/xsignal.h index f330888..d89e2bc 100644 --- a/support/xsignal.h +++ b/support/xsignal.h @@ -37,6 +37,23 @@ void xsigaction (int sig, const struct sigaction *newact, void xpthread_sigmask (int how, const sigset_t *set, sigset_t *oldset); +/* Allocate and activate an alternate signal stack. This stack will + have SIZE + MINSIGSTKSZ bytes of space, rounded up to a whole + number of pages. There will be large (at least 1 MiB) inaccessible + guard bands on either side of it. The return value is a cookie + that can be passed to xfree_sigstack to deactivate and deallocate + the stack again. It is not necessary to call sigaltstack after + calling this function. Terminates the process on error. */ +void *xalloc_sigstack (size_t size); + +/* Deactivate and deallocate a signal stack created by xalloc_sigstack. */ +void xfree_sigstack (void *stack); + +/* Extract the actual address and size of the alternate signal stack from + the cookie returned by xalloc_sigstack. */ +void xget_sigstack_location (const void *stack, unsigned char **addrp, + size_t *sizep); + __END_DECLS #endif /* SUPPORT_SIGNAL_H */ |