diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2012-08-16 18:19:37 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2012-08-16 18:19:37 +0000 |
commit | b6314326114bec33f9e727e1692ad9ea3ef3369e (patch) | |
tree | da7da36596239be0c968dabff084a9c42e44b060 /regress/libexec/ld.so | |
parent | 596dfdcbfaa18ddc027efc2facbfd1e00ba7e2f6 (diff) |
Add a test case to verify ld.so's randomdata section is initialized
too, since interpreters will be initialized by a slightly different
code path than executables.
Diffstat (limited to 'regress/libexec/ld.so')
-rw-r--r-- | regress/libexec/ld.so/randomdata/Makefile | 4 | ||||
-rw-r--r-- | regress/libexec/ld.so/randomdata/ld.so-cookie/Makefile | 5 | ||||
-rw-r--r-- | regress/libexec/ld.so/randomdata/ld.so-cookie/test.c | 21 |
3 files changed, 28 insertions, 2 deletions
diff --git a/regress/libexec/ld.so/randomdata/Makefile b/regress/libexec/ld.so/randomdata/Makefile index d8600b4214f..96fde384ee2 100644 --- a/regress/libexec/ld.so/randomdata/Makefile +++ b/regress/libexec/ld.so/randomdata/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.1 2012/08/16 17:21:05 matthew Exp $ +# $OpenBSD: Makefile,v 1.2 2012/08/16 18:19:36 matthew Exp $ -SUBDIR+= libaa prog-dynamic prog-static +SUBDIR+= libaa prog-dynamic prog-static ld.so-cookie .include <bsd.subdir.mk> diff --git a/regress/libexec/ld.so/randomdata/ld.so-cookie/Makefile b/regress/libexec/ld.so/randomdata/ld.so-cookie/Makefile new file mode 100644 index 00000000000..6d7a7ab712d --- /dev/null +++ b/regress/libexec/ld.so/randomdata/ld.so-cookie/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 2012/08/16 18:19:36 matthew Exp $ + +PROG=test + +.include <bsd.regress.mk> diff --git a/regress/libexec/ld.so/randomdata/ld.so-cookie/test.c b/regress/libexec/ld.so/randomdata/ld.so-cookie/test.c new file mode 100644 index 00000000000..a863637b52b --- /dev/null +++ b/regress/libexec/ld.so/randomdata/ld.so-cookie/test.c @@ -0,0 +1,21 @@ +#include <assert.h> +#include <dlfcn.h> +#include <stddef.h> + +int +main() +{ + void *dso; + long *guardptr; + long guard; + + dso = dlopen("/usr/libexec/ld.so", RTLD_LOCAL|RTLD_LAZY); + assert(dso != NULL); + guardptr = dlsym(dso, "__guard"); + assert(guardptr != NULL); + + guard = *guardptr; + assert(guard != 0); + + return (0); +} |