about summary refs log tree commit diff
path: root/nptl/tst-stackguard1.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-07-29 16:56:26 +0000
committerJakub Jelinek <jakub@redhat.com>2005-07-29 16:56:26 +0000
commit979da19ab840553e3862f3b2aea50ad07118616f (patch)
tree150fffcd4616402c468e87600cf96568d7c34302 /nptl/tst-stackguard1.c
parent1ce6c1300b11dcd825ee372b9354607f5069a6f1 (diff)
downloadglibc-979da19ab840553e3862f3b2aea50ad07118616f.tar.gz
glibc-979da19ab840553e3862f3b2aea50ad07118616f.tar.xz
glibc-979da19ab840553e3862f3b2aea50ad07118616f.zip
* 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.
Diffstat (limited to 'nptl/tst-stackguard1.c')
-rw-r--r--nptl/tst-stackguard1.c8
1 files changed, 6 insertions, 2 deletions
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");