summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/dl-osinfo.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-27 09:15:54 +0000
committerJakub Jelinek <jakub@redhat.com>2005-06-27 09:15:54 +0000
commit5570fbd25a574d54ab135e1d3cdac0bc74029689 (patch)
tree6af711ed17dd644491e68d1a85c22e51bac87179 /sysdeps/unix/sysv/linux/dl-osinfo.h
parente4edec582dc1fb924a2cfbfb07409fd7b3c84a26 (diff)
Updated to fedora-glibc-20050627T0850
Diffstat (limited to 'sysdeps/unix/sysv/linux/dl-osinfo.h')
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 03e1de716c..e374023841 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -23,6 +23,7 @@
#include <sys/utsname.h>
#include "kernel-features.h"
#include <dl-sysdep.h>
+#include <stdint.h>
#ifndef MIN
# define MIN(a,b) (((a)<(b))?(a):(b))
@@ -157,3 +158,24 @@ _dl_discover_osversion (void)
else if (__LINUX_KERNEL_VERSION > 0) \
FATAL ("FATAL: cannot determine kernel version\n"); \
} while (0)
+
+static inline uintptr_t __attribute__ ((always_inline))
+_dl_setup_stack_chk_guard (void)
+{
+ uintptr_t ret;
+#ifdef ENABLE_STACKGUARD_RANDOMIZE
+ int fd = __open ("/dev/urandom", O_RDONLY);
+ if (fd >= 0)
+ {
+ ssize_t reslen = __read (fd, &ret, sizeof (ret));
+ __close (fd);
+ if (reslen == (ssize_t) sizeof (ret))
+ return ret;
+ }
+#endif
+ ret = 0;
+ unsigned char *p = (unsigned char *) &ret;
+ p[sizeof (ret) - 1] = 255;
+ p[sizeof (ret) - 2] = '\n';
+ return ret;
+}