Browse Source

remove unused FORTIFY code fragments

Waldemar Brodkorb 6 years ago
parent
commit
a745c4bfc8

+ 2 - 14
include/features.h

@@ -207,9 +207,8 @@
 /* disable unsupported features */
 # undef __LDBL_COMPAT
 
-# ifndef __UCLIBC_HAS_FORTIFY__
-#  undef _FORTIFY_SOURCE
-# endif
+/* no support for FORTIFY */
+# undef _FORTIFY_SOURCE
 
 # ifndef __UCLIBC_HAS_THREADS__
 #  if defined _REENTRANT || defined _THREAD_SAFE
@@ -352,17 +351,6 @@
 # define __USE_REENTRANT	1
 #endif
 
-#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
-    && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
-# if _FORTIFY_SOURCE > 1
-#  define __USE_FORTIFY_LEVEL 2
-# else
-#  define __USE_FORTIFY_LEVEL 1
-# endif
-#else
-# define __USE_FORTIFY_LEVEL 0
-#endif
-
 /* We do support the IEC 559 math functionality, real and complex.  */
 #ifdef __UCLIBC_HAS_FLOATS__
 #define __STDC_IEC_559__		1

+ 0 - 5
include/libc-internal.h

@@ -67,11 +67,6 @@ libc_hidden_proto(__xpg_strerror_r)
 /* internal access to program name */
 extern const char *__uclibc_progname attribute_hidden;
 
-#  ifdef __UCLIBC_HAS_FORTIFY__
-extern void __chk_fail(void) attribute_noreturn;
-libc_hidden_proto(__chk_fail)
-#  endif
-
 #  ifdef __UCLIBC_HAS_SSP__
 extern void __stack_chk_fail(void) attribute_noreturn __cold;
 #  endif

+ 0 - 7
include/sys/cdefs.h

@@ -129,10 +129,6 @@
 #endif
 
 
-/* Fortify support.  */
-#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
-#define __bos0(ptr) __builtin_object_size (ptr, 0)
-
 #if __GNUC_PREREQ (4,3)
 # define __warndecl(name, msg) \
   extern void name (void) __attribute__((__warning__ (msg)))
@@ -300,9 +296,6 @@
 #if __GNUC_PREREQ (3,4)
 # define __attribute_warn_unused_result__ \
    __attribute__ ((__warn_unused_result__))
-# if __USE_FORTIFY_LEVEL > 0
-#  define __wur __attribute_warn_unused_result__
-# endif
 #else
 # define __attribute_warn_unused_result__ /* empty */
 #endif

+ 0 - 6
include/unistd.h

@@ -1248,12 +1248,6 @@ extern void swab (const void *__restrict __from, void *__restrict __to,
 extern char *ctermid (char *__s) __THROW;
 #endif
 
-
-/* Define some macros helping to catch buffer overflows.  */
-#if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline
-# include <bits/unistd.h>
-#endif
-
 __END_DECLS
 
 

+ 0 - 6
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.  */

+ 0 - 9
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

+ 1 - 1
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 \

+ 0 - 20
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