This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] tst-longjmp_chk2: add comments/sanity check
- From: Mike Frysinger <vapier at gentoo dot org>
- To: libc-alpha at sourceware dot org
- Date: Sun, 29 Dec 2013 16:31:25 -0500
- Subject: [PATCH] tst-longjmp_chk2: add comments/sanity check
- Authentication-results: sourceware.org; auth=none
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>
---
debug/tst-longjmp_chk2.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/debug/tst-longjmp_chk2.c b/debug/tst-longjmp_chk2.c
index 22d8bf0..fd543e7 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,9 @@ static void
stackoverflow_handler (int sig)
{
stack_t altstack;
- pass++;
+ /* 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. */
--
1.8.4.3