Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Frysinger committed Mar 13, 2014
1 parent 2d63a51 commit 5896c8b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions 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.
Expand Down
7 changes: 6 additions & 1 deletion 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>
Expand All @@ -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. */
Expand Down

0 comments on commit 5896c8b

Please sign in to comment.