1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

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>
This commit is contained in:
Mike Frysinger
2013-12-29 16:30:35 -05:00
parent 2d63a517e4
commit 5896c8bdd9
2 changed files with 11 additions and 1 deletions

View 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. */