Lines 46-51
Link Here
|
46 |
|
46 |
|
47 |
unsigned long __guard = 0UL; |
47 |
unsigned long __guard = 0UL; |
48 |
|
48 |
|
|
|
49 |
/* Use of __* functions from the rest of glibc here avoids |
50 |
* initialisation problems for executables preloaded with |
51 |
* libraries that overload the associated standard library |
52 |
* functions. |
53 |
*/ |
49 |
void |
54 |
void |
50 |
__guard_setup (void) |
55 |
__guard_setup (void) |
51 |
{ |
56 |
{ |
Lines 76-88
Link Here
|
76 |
{ |
81 |
{ |
77 |
int fd; |
82 |
int fd; |
78 |
#ifdef HAVE_DEV_ERANDOM |
83 |
#ifdef HAVE_DEV_ERANDOM |
79 |
if ((fd = open ("/dev/erandom", O_RDONLY)) == (-1)) |
84 |
if ((fd = __open ("/dev/erandom", O_RDONLY)) == (-1)) |
80 |
#endif |
85 |
#endif |
81 |
fd = open ("/dev/urandom", O_RDONLY); |
86 |
fd = __open ("/dev/urandom", O_RDONLY); |
82 |
if (fd != (-1)) |
87 |
if (fd != (-1)) |
83 |
{ |
88 |
{ |
84 |
size = read (fd, (char *) &__guard, sizeof (__guard)); |
89 |
size = __read (fd, (char *) &__guard, sizeof (__guard)); |
85 |
close (fd); |
90 |
__close (fd); |
86 |
if (size == sizeof (__guard)) |
91 |
if (size == sizeof (__guard)) |
87 |
return; |
92 |
return; |
88 |
} |
93 |
} |
Lines 97-103
Link Here
|
97 |
* terminator canary */ |
102 |
* terminator canary */ |
98 |
struct timeval tv; |
103 |
struct timeval tv; |
99 |
|
104 |
|
100 |
gettimeofday (&tv, NULL); |
105 |
__gettimeofday (&tv, NULL); |
101 |
__guard ^= tv.tv_usec ^ tv.tv_sec; |
106 |
__guard ^= tv.tv_usec ^ tv.tv_sec; |
102 |
} |
107 |
} |
103 |
} |
108 |
} |