]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
tst-longjmp_chk2: add comments/sanity check
authorMike Frysinger <vapier@gentoo.org>
Sun, 29 Dec 2013 21:30:35 +0000 (16:30 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 13 Mar 2014 21:05:29 +0000 (17:05 -0400)
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>
ChangeLog
debug/tst-longjmp_chk2.c

index e6ac77868597e4cf9dccc9f8f1cf002ac072f0fa..42b2938a9c8793dfdff6b18a7bc1bcb7e85ea08d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-13  Mike Frysinger  <vapier@gentoo.org>
+
+       * debug/tst-longjmp_chk2.c: Update header comment.
+       (stackoverflow_handler): Add comment.  Call assert on pass value.
+
 2014-03-13  Igor Zamyatin  <igor.zamyatin@intel.com>
 
        * config.h.in (HAVE_AVX512_SUPPORT): New #undef.
index 22d8bf0941adf6877cff7c10dfc083b1e04b9c9e..dae9ca01e5b21c7f9c7bce5237a62d42a1c96215 100644 (file)
@@ -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.  */