summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Dempsky <matthew@cvs.openbsd.org>2012-08-17 15:11:13 +0000
committerMatthew Dempsky <matthew@cvs.openbsd.org>2012-08-17 15:11:13 +0000
commit00059070bba1a9212d7e10bb2cdaa66485021b37 (patch)
tree9c4415b70f7d5b95185ec001d95dca9df252a4bd
parentf4a1064272f4f30508ba435644a8ac3629b545bd (diff)
Double check that we're not testing libc's __guard. Changing ld.so's
__guard symbol to HIDDEN causes dlsym() to return a pointer to libc's __guard instead, which can cause the test to wrongly pass even if ld.so's random data segments are not being initialized properly.
-rw-r--r--regress/libexec/ld.so/randomdata/ld.so-cookie/test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/randomdata/ld.so-cookie/test.c b/regress/libexec/ld.so/randomdata/ld.so-cookie/test.c
index 89753ff2540..3053058913f 100644
--- a/regress/libexec/ld.so/randomdata/ld.so-cookie/test.c
+++ b/regress/libexec/ld.so/randomdata/ld.so-cookie/test.c
@@ -8,11 +8,13 @@ main()
void *dso;
long *guardptr;
long guard;
+ extern long __guard[];
dso = dlopen("ld.so", RTLD_LOCAL|RTLD_LAZY);
assert(dso != NULL);
guardptr = dlsym(dso, "__guard");
assert(guardptr != NULL);
+ assert(guardptr != &__guard[0]);
guard = *guardptr;
assert(guard != 0);