From a745c4bfc8a9b5db4e48387170da0dc1d39e3abe Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 7 Nov 2017 20:50:27 +0100 Subject: remove unused FORTIFY code fragments --- libc/string/x86_64/memcpy.S | 6 ------ libc/string/x86_64/memset.S | 9 --------- libc/sysdeps/linux/common/Makefile.in | 2 +- libc/sysdeps/linux/common/ssp.c | 20 -------------------- 4 files changed, 1 insertion(+), 36 deletions(-) (limited to 'libc') diff --git a/libc/string/x86_64/memcpy.S b/libc/string/x86_64/memcpy.S index e164278df..af2f914ff 100644 --- a/libc/string/x86_64/memcpy.S +++ b/libc/string/x86_64/memcpy.S @@ -25,12 +25,6 @@ #define MEMPCPY_P (defined memcpy) .text -#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ -ENTRY (__memcpy_chk) - cmpq %rdx, %rcx - jb HIDDEN_JUMPTARGET (__chk_fail) -END (__memcpy_chk) -#endif ENTRY (BP_SYM (memcpy)) /* Cutoff for the big loop is a size of 32 bytes since otherwise the loop will never be entered. */ diff --git a/libc/string/x86_64/memset.S b/libc/string/x86_64/memset.S index d6744129d..fa79275a7 100644 --- a/libc/string/x86_64/memset.S +++ b/libc/string/x86_64/memset.S @@ -28,11 +28,6 @@ #define LARGE $120000 .text -#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ -ENTRY (__memset_chk) - cmpq %rdx, %rcx - jb HIDDEN_JUMPTARGET (__chk_fail) -END (__memset_chk) #endif ENTRY (memset) #if BZERO_P @@ -140,7 +135,3 @@ END (memset) #if !BZERO_P libc_hidden_def(memset) #endif - -#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ -strong_alias (__memset_chk, __memset_zero_constant_len_parameter) -#endif diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index faed6fd5d..5ba1906d7 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -14,7 +14,7 @@ CSRC- := ssp-local.c CSRC_LFS := $(notdir $(wildcard $(COMMON_DIR)/*64.c)) CSRC-y := $(filter-out llseek.c $(CSRC_LFS),$(CSRC-y)) CSRC-y += llseek.c $(CSRC_LFS) -CSRC-$(findstring y,$(UCLIBC_HAS_SSP)$(UCLIBC_HAS_FORTIFY)) += ssp.c +CSRC-$(findstring y,$(UCLIBC_HAS_SSP)) += ssp.c # we need these internally: fstatfs.c statfs.c CSRC-$(UCLIBC_LINUX_SPECIFIC) += \ bdflush.c \ diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index 87e10c2da..2a98a4e2a 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -85,23 +85,3 @@ ssp_handler(void) } strong_alias(ssp_handler,__stack_chk_fail) - -#ifdef __UCLIBC_HAS_FORTIFY__ -/* should be redone when activated to use common code above. - * for now, it works without debugging support */ -void __chk_fail(void) -{ - static const char msg_fail[] = "*** buffer overflow detected ***: "; - static const char msg_terminated[] = " terminated"; - pid_t pid; - - do_msg(msg_fail, __uclibc_progname, msg_terminated); - - pid = getpid(); - (void)kill(pid, SIGKILL); - /* The loop is added only to keep gcc happy. */ - while(1) - _exit(127); -} -libc_hidden_def(__chk_fail) -#endif -- cgit v1.2.3