aboutsummaryrefslogtreecommitdiff
path: root/debug/tst-longjmp_chk2.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-12-29 16:30:35 -0500
committerMike Frysinger <vapier@gentoo.org>2014-03-13 17:05:29 -0400
commit5896c8bdd9f73cdc816a96e107ca1f7a6bc6921e (patch)
tree5ae713ed9de3470312dfd100e66cd7b7e179cd33 /debug/tst-longjmp_chk2.c
parent2d63a517e4084ec80403cd9f278690fa8b676cc4 (diff)
downloadglibc-5896c8bdd9f73cdc816a96e107ca1f7a6bc6921e.tar
glibc-5896c8bdd9f73cdc816a96e107ca1f7a6bc6921e.tar.gz
glibc-5896c8bdd9f73cdc816a96e107ca1f7a6bc6921e.tar.bz2
glibc-5896c8bdd9f73cdc816a96e107ca1f7a6bc6921e.zip
tst-longjmp_chk2: add comments/sanity check
If the longjmp checking code is slightly broken, this code can loop forever which isn't too helpful. Add a sanity check to keep that from happening. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'debug/tst-longjmp_chk2.c')
-rw-r--r--debug/tst-longjmp_chk2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/debug/tst-longjmp_chk2.c b/debug/tst-longjmp_chk2.c
index 22d8bf0941..dae9ca01e5 100644
--- a/debug/tst-longjmp_chk2.c
+++ b/debug/tst-longjmp_chk2.c
@@ -1,4 +1,6 @@
-/* Test case mostly written by Paolo Bonzini <pbonzini@redhat.com>. */
+/* Verify longjmp fortify checking does not reject signal stacks.
+
+ Test case mostly written by Paolo Bonzini <pbonzini@redhat.com>. */
#include <assert.h>
#include <setjmp.h>
#include <signal.h>
@@ -18,7 +20,10 @@ static void
stackoverflow_handler (int sig)
{
stack_t altstack;
+ /* Sanity check to keep test from looping forever (in case the longjmp
+ chk code is slightly broken). */
pass++;
+ assert (pass < 5);
sigaltstack (NULL, &altstack);
/* Using printf is not really kosher in signal handlers but we know
it will work. */