diff options
Diffstat (limited to 'libc/sysdeps/linux/common/ssp.c')
-rw-r--r-- | libc/sysdeps/linux/common/ssp.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index d8088ef60..73d7113b8 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -29,21 +29,22 @@ #include <string.h> #include <unistd.h> #include <signal.h> +#if defined __UCLIBC_HAS_SYSLOG__ #include <sys/syslog.h> -/* Experimentally off - libc_hidden_proto(memset) */ -/* Experimentally off - libc_hidden_proto(strlen) */ -libc_hidden_proto(sigaction) -libc_hidden_proto(sigfillset) -libc_hidden_proto(sigdelset) -libc_hidden_proto(sigprocmask) -libc_hidden_proto(write) -libc_hidden_proto(openlog) -libc_hidden_proto(syslog) -libc_hidden_proto(closelog) -libc_hidden_proto(kill) -libc_hidden_proto(getpid) -libc_hidden_proto(_exit) +/* libc_hidden_proto(openlog) */ +/* libc_hidden_proto(syslog) */ +/* libc_hidden_proto(closelog) */ +#endif + +/* libc_hidden_proto(sigaction) */ +/* libc_hidden_proto(sigfillset) */ +/* libc_hidden_proto(sigdelset) */ +/* libc_hidden_proto(sigprocmask) */ +/* libc_hidden_proto(write) */ +/* libc_hidden_proto(kill) */ +/* libc_hidden_proto(getpid) */ +/* libc_hidden_proto(_exit) */ static void block_signals(void) { @@ -63,15 +64,17 @@ static void block_signals(void) sigaction(SSP_SIGTYPE, &sa, NULL); } -static void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) +static void ssp_write(int fd, const char *msg1, const char *msg2, const char *msg3) __cold { write(fd, msg1, strlen(msg1)); write(fd, msg2, strlen(msg2)); write(fd, msg3, strlen(msg3)); write(fd, "()\n", 3); +#if defined __UCLIBC_HAS_SYSLOG__ openlog("ssp", LOG_CONS | LOG_PID, LOG_USER); syslog(LOG_INFO, "%s%s%s()", msg1, msg2, msg3); closelog(); +#endif } static attribute_noreturn void terminate(void) @@ -80,7 +83,7 @@ static attribute_noreturn void terminate(void) _exit(127); } -void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn; +void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn __cold; void __stack_smash_handler(char func[], int damaged) { static const char message[] = ": stack smashing attack in function "; @@ -94,7 +97,7 @@ void __stack_smash_handler(char func[], int damaged) terminate(); } -void __stack_chk_fail(void) attribute_noreturn; +void __stack_chk_fail(void) attribute_noreturn __cold; void __stack_chk_fail(void) { static const char msg1[] = "stack smashing detected: "; |