This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2] 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 <>
 debug/tst-longjmp_chk2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/debug/tst-longjmp_chk2.c b/debug/tst-longjmp_chk2.c
index 22d8bf0..dae9ca0 100644
--- a/debug/tst-longjmp_chk2.c
+++ b/debug/tst-longjmp_chk2.c
@@ -1,4 +1,6 @@
-/* Test case mostly written by Paolo Bonzini <>.  */
+/* Verify longjmp fortify checking does not reject signal stacks.
+   Test case mostly written by Paolo Bonzini <>.  */
 #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).  */
+  assert (pass < 5);
   sigaltstack (NULL, &altstack);
   /* Using printf is not really kosher in signal handlers but we know
      it will work.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]