]> sourceware.org Git - glibc.git/commitdiff
chk: Add and fix hidden builtin definitions for *_chk
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 3 Aug 2023 19:16:41 +0000 (21:16 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 3 Aug 2023 20:46:48 +0000 (22:46 +0200)
Otherwise on gnu-i686 there are unwanted PLT entries in libc.so when
fortification is enabled.

Tested for i686-gnu, x86_64-gnu, i686-linux-gnu and x86_64-linux-gnu

debug/longjmp_chk.c
debug/strncpy_chk.c
include/setjmp.h
include/stdlib.h
include/string.h
setjmp/longjmp.c

index 1bc33c57693f48339faa669136cebb112a857aa1..c527e22db6e2b17006929c6b612c6e1e033e2368 100644 (file)
@@ -21,3 +21,4 @@
 #define __libc_siglongjmp __longjmp_chk
 
 #include <setjmp/longjmp.c>
+libc_hidden_def (__longjmp_chk)
index cb142b820fe1df84526ca281542f282fef1e3620..966df2739b3cfa732ef6d8d9df01cb61c9dc3f58 100644 (file)
@@ -27,3 +27,4 @@ __strncpy_chk (char *s1, const char *s2, size_t n, size_t s1len)
 
   return strncpy (s1, s2, n);
 }
+libc_hidden_builtin_def (__strncpy_chk)
index 26c6775d08d5fa73aedbb3bb694cf673b4059f58..d2353be71bdc196f7b9097c107ec7bf544f93951 100644 (file)
@@ -11,6 +11,14 @@ extern void __longjmp (__jmp_buf __env, int __val)
 extern void ____longjmp_chk (__jmp_buf __env, int __val)
      __attribute__ ((__noreturn__)) attribute_hidden;
 
+extern void __longjmp_chk (sigjmp_buf env, int val)
+         __attribute__ ((noreturn)) attribute_hidden;
+/* The redirection in the installed header does not work with
+   libc_hidden_proto.  */
+#define longjmp __longjmp_chk
+#define siglongjmp __longjmp_chk
+libc_hidden_proto (__longjmp_chk)
+
 /* Internal function to possibly save the current mask of blocked signals
    in ENV, and always set the flag saying whether or not it was saved.
    This is used by the machine-dependent definition of `__sigsetjmp'.
index 7deb8193d746ff0b87e06ebf8abf9637bf866e26..d1d00c0f6f262df3b2f0354f70f726123f821a1a 100644 (file)
@@ -59,6 +59,8 @@ libc_hidden_proto (__isoc23_strtoull_l)
    libc_hidden_proto.  */
 # undef strtol
 # define strtol __isoc23_strtol
+# undef atoi
+# define atoi(nptr) __isoc23_strtol(nptr, NULL, 10)
 # undef strtoul
 # define strtoul __isoc23_strtoul
 # undef strtoll
index 659530d1aa67a3d3ec9ef9d9f5f1840090005323..86d1fa4abe7c58eb231bbad4483c70a51ffdf48b 100644 (file)
@@ -214,6 +214,7 @@ libc_hidden_builtin_proto (__memmove_chk)
 libc_hidden_builtin_proto (__mempcpy_chk)
 libc_hidden_builtin_proto (__memset_chk)
 libc_hidden_builtin_proto (__stpcpy_chk)
+libc_hidden_builtin_proto (__strncpy_chk)
 
 #endif
 
index 69f540ea220945174a560813421dee58b444348e..24795ecbb5946ac627d0b1af381a8fb323c9eae9 100644 (file)
@@ -19,6 +19,8 @@
 #include <setjmpP.h>
 #include <signal.h>
 
+#undef longjmp
+#undef siglongjmp
 
 /* Set the signal mask to the one specified in ENV, and jump
    to the position specified in ENV, causing the setjmp
This page took 0.043776 seconds and 5 git commands to generate.