From 979da19ab840553e3862f3b2aea50ad07118616f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 29 Jul 2005 16:56:26 +0000 Subject: * sysdeps/unix/sysv/dl-osinfo.h: Include errno.h, hp-timing.h, endian.h. (_dl_setup_stack_chk_guard): Even without --enable-stackguard-randomization attempt to do some guard randomization using hp-timing (if available) and kernel stack and mmap randomization. * elf/tst-stackguard1.c (do_test): Don't fail if the poor man's randomization doesn't work well enough. nptl/ * tst-stackguard1.c (do_test): Don't fail if the poor man's randomization doesn't work well enough. --- nptl/tst-stackguard1.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'nptl/tst-stackguard1.c') diff --git a/nptl/tst-stackguard1.c b/nptl/tst-stackguard1.c index 15c30aeb6b..d9bbe206c3 100644 --- a/nptl/tst-stackguard1.c +++ b/nptl/tst-stackguard1.c @@ -190,17 +190,21 @@ do_test (void) the 16 runs, something is very wrong. */ int ndifferences = 0; int ndefaults = 0; + int npartlyrandomized = 0; for (i = 0; i < N; ++i) { if (child_stack_chk_guards[i] != child_stack_chk_guards[i+1]) ndifferences++; else if (child_stack_chk_guards[i] == default_guard) ndefaults++; + else if (*(char *) &child_stack_chk_guards[i] == 0) + npartlyrandomized = 0; } - printf ("differences %d defaults %d\n", ndifferences, ndefaults); + printf ("differences %d defaults %d partly randomized %d\n", + ndifferences, ndefaults, npartlyrandomized); - if (ndifferences < N / 2 && ndefaults < N / 2) + if ((ndifferences + ndefaults + npartlyrandomized) < 3 * N / 4) { puts ("stack guard canaries are not randomized enough"); puts ("nor equal to the default canary value"); -- cgit v1.2.3