diff options
author | kib <kib@FreeBSD.org> | 2010-08-17 09:13:26 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-08-17 09:13:26 +0000 |
commit | 5a79777b4407edd39781e06216e4dc6ca68bb6a7 (patch) | |
tree | 2f639ad563c61b228d123038b15beca40d36a4ba /lib/libc/sys/stack_protector.c | |
parent | 680fe863d9e18febb130562fe69135f824b59b45 (diff) | |
download | FreeBSD-src-5a79777b4407edd39781e06216e4dc6ca68bb6a7.zip FreeBSD-src-5a79777b4407edd39781e06216e4dc6ca68bb6a7.tar.gz |
Use aux vector to get values for SSP canary, pagesize, pagesizes array,
number of host CPUs and osreldate.
This eliminates the last sysctl(2) calls from the dynamically linked image
startup.
No objections from: kan
Tested by: marius (sparc64)
MFC after: 1 month
Diffstat (limited to 'lib/libc/sys/stack_protector.c')
-rw-r--r-- | lib/libc/sys/stack_protector.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc/sys/stack_protector.c b/lib/libc/sys/stack_protector.c index 14c20eb..b0108f9 100644 --- a/lib/libc/sys/stack_protector.c +++ b/lib/libc/sys/stack_protector.c @@ -34,10 +34,13 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/sysctl.h> #include <sys/types.h> +#include <errno.h> +#include <link.h> #include <signal.h> #include <string.h> #include <syslog.h> #include <unistd.h> +#include "libc_private.h" extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen); @@ -54,9 +57,14 @@ __guard_setup(void) { int mib[2]; size_t len; + int error; if (__stack_chk_guard[0] != 0) return; + error = _elf_aux_info(AT_CANARY, __stack_chk_guard, + sizeof(__stack_chk_guard)); + if (error == 0 && __stack_chk_guard[0] != 0) + return; mib[0] = CTL_KERN; mib[1] = KERN_ARND; |