Author: kib
Date: Tue Aug 24 12:58:54 2010
New Revision: 211748
URL: http://svn.freebsd.org/changeset/base/211748

Log:
  Move the __stack_chk_fail_lo...@fbsd_1.0 compat symbol definition into
  the separate .o for libc_pic.a. This prevents rtld from making the
  symbol global.
  
  Putting the stack_protector_compat.c into the public domain acknowledged
  by kan.
  
  Reviewed by:  kan
  MFC after:    2 weeks

Added:
  head/lib/libc/sys/stack_protector_compat.c   (contents, props changed)
Modified:
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/stack_protector.c

Modified: head/lib/libc/sys/Makefile.inc
==============================================================================
--- head/lib/libc/sys/Makefile.inc      Tue Aug 24 12:56:45 2010        
(r211747)
+++ head/lib/libc/sys/Makefile.inc      Tue Aug 24 12:58:54 2010        
(r211748)
@@ -18,7 +18,7 @@
 .endif
 
 # Sources common to both syscall interfaces:
-SRCS+= stack_protector.c __error.c
+SRCS+= stack_protector.c stack_protector_compat.c __error.c
 .if !defined(WITHOUT_SYSCALL_COMPAT)
 SRCS+= fcntl.c ftruncate.c lseek.c mmap.c pread.c pwrite.c truncate.c
 PSEUDO+= _fcntl.o

Modified: head/lib/libc/sys/stack_protector.c
==============================================================================
--- head/lib/libc/sys/stack_protector.c Tue Aug 24 12:56:45 2010        
(r211747)
+++ head/lib/libc/sys/stack_protector.c Tue Aug 24 12:58:54 2010        
(r211748)
@@ -116,8 +116,6 @@ __chk_fail(void)
        __fail("buffer overflow detected; terminated");
 }
 
-#ifdef PIC
-__sym_compat(__stack_chk_fail_local, __stack_chk_fail, FBSD_1.0);
-#else
+#ifndef PIC
 __weak_reference(__stack_chk_fail, __stack_chk_fail_local);
 #endif

Added: head/lib/libc/sys/stack_protector_compat.c
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/sys/stack_protector_compat.c  Tue Aug 24 12:58:54 2010        
(r211748)
@@ -0,0 +1,20 @@
+/*
+ * Written by Alexander Kabaev <k...@freebsd.org>
+ * The file is in public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+void __stack_chk_fail(void);
+
+#ifdef PIC
+void
+__stack_chk_fail_local_hidden(void)
+{
+
+       __stack_chk_fail();
+}
+
+__sym_compat(__stack_chk_fail_local, __stack_chk_fail_local_hidden, FBSD_1.0);
+#endif
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to