Author: kevans
Date: Thu Jan 16 03:38:06 2020
New Revision: 356775
URL: https://svnweb.freebsd.org/changeset/base/356775

Log:
  MFC r356356, r356358, r356422: replace gcclibs' libssp
  
  r356356:
  Provide libssp based on libc
  
  For libssp.so, rebuild stack_protector.c with FORTIFY_SOURCE stubs that just
  abort built into it.
  
  For libssp_nonshared.a, steal stack_protector_compat.c from
  ^/lib/libc/secure and massage it to maintain that __stack_chk_fail_local
  is a hidden symbol.
  
  libssp is now built unconditionally regardless of {WITH,WITHOUT}_SSP in the
  build environment, and the gcclibs version has been disconnected from the
  build in favor of this one.
  
  r356358:
  libssp: fix FORTIFY_SOURCE stub declarations
  
  The LSB 4.1 that I referenced omitted the varargs, and I failed to catch it.
  The __vsnprintf_chk error was from just downright misreading the page. GCC6
  caught all of these, but I had only tested GCC4.2.
  
  r356422:
  Update libssp paths in various Makefile.depend* files
  
  I've been advised that the model that uses these are fairly resilient, but
  we do know the proper path to use (or remove, in the case of ^/targets/...),
  so go ahead and update them to reflect that.

Added:
  stable/12/lib/libssp/
     - copied from r356356, head/lib/libssp/
  stable/12/lib/libssp_nonshared/
     - copied from r356356, head/lib/libssp_nonshared/
Modified:
  stable/12/Makefile.inc1
  stable/12/ObsoleteFiles.inc
  stable/12/gnu/lib/Makefile
  stable/12/lib/Makefile
  stable/12/lib/libc/Makefile.depend.options
  stable/12/lib/libssp/fortify_stubs.c
  stable/12/lib/libsysdecode/Makefile.depend
  stable/12/share/mk/local.dirdeps.mk
  stable/12/share/mk/local.gendirdeps.mk
  stable/12/share/mk/src.libnames.mk
  stable/12/targets/pseudo/userland/gnu/Makefile.depend
  stable/12/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Added:
  stable/11/lib/libssp/
     - copied from r356356, head/lib/libssp/
  stable/11/lib/libssp_nonshared/
     - copied from r356356, head/lib/libssp_nonshared/
Modified:
  stable/11/Makefile.inc1
  stable/11/ObsoleteFiles.inc
  stable/11/gnu/lib/Makefile
  stable/11/lib/Makefile
  stable/11/lib/libssp/fortify_stubs.c
  stable/11/share/mk/local.dirdeps.mk
  stable/11/share/mk/local.gendirdeps.mk
  stable/11/share/mk/src.libnames.mk
  stable/11/targets/pseudo/userland/gnu/Makefile.depend
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/Makefile.inc1
==============================================================================
--- stable/12/Makefile.inc1     Thu Jan 16 03:24:45 2020        (r356774)
+++ stable/12/Makefile.inc1     Thu Jan 16 03:38:06 2020        (r356775)
@@ -2539,7 +2539,7 @@ libraries: .MAKE .PHONY
 #
 _prereq_libs= lib/libcompiler_rt
 .if ${MK_SSP} != "no"
-_prereq_libs+= gnu/lib/libssp/libssp_nonshared
+_prereq_libs+= lib/libssp_nonshared
 .endif
 
 # These dependencies are not automatically generated:

Modified: stable/12/ObsoleteFiles.inc
==============================================================================
--- stable/12/ObsoleteFiles.inc Thu Jan 16 03:24:45 2020        (r356774)
+++ stable/12/ObsoleteFiles.inc Thu Jan 16 03:38:06 2020        (r356775)
@@ -38,6 +38,13 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20200115: gcc libssp removed
+OLD_FILES+=usr/include/ssp/ssp.h
+OLD_FILES+=usr/include/ssp/stdio.h
+OLD_FILES+=usr/include/ssp/string.h
+OLD_FILES+=usr/include/ssp/unistd.h
+OLD_DIRS+=usr/include/ssp
+
 # 20200107: new clang import which bumps version from 9.0.0 to 9.0.1.
 OLD_FILES+=usr/lib/clang/9.0.0/include/cuda_wrappers/algorithm
 OLD_FILES+=usr/lib/clang/9.0.0/include/cuda_wrappers/complex

Modified: stable/12/gnu/lib/Makefile
==============================================================================
--- stable/12/gnu/lib/Makefile  Thu Jan 16 03:24:45 2020        (r356774)
+++ stable/12/gnu/lib/Makefile  Thu Jan 16 03:38:06 2020        (r356775)
@@ -8,7 +8,6 @@ SUBDIR.${MK_GCC}+=      libgcov
 .if ${MK_GCC} != "no" && ${MK_OPENMP} == "no"
 SUBDIR+=               libgomp
 .endif
-SUBDIR.${MK_SSP}+=     libssp
 SUBDIR.${MK_TESTS}+=   tests
 
 .if ${MK_BSD_CRTBEGIN} == "no"

Modified: stable/12/lib/Makefile
==============================================================================
--- stable/12/lib/Makefile      Thu Jan 16 03:24:45 2020        (r356774)
+++ stable/12/lib/Makefile      Thu Jan 16 03:38:06 2020        (r356775)
@@ -18,6 +18,8 @@ SUBDIR_BOOTSTRAP= \
        ${_libcplusplus} \
        ${_libcxxrt} \
        libelf \
+       libssp \
+       libssp_nonshared \
        msun
 
 # The main list; please keep these sorted alphabetically.
@@ -106,7 +108,9 @@ SUBDIR_DEPEND_libarchive= libz libbz2 libexpat liblzma
 SUBDIR_DEPEND_libauditdm= libbsm
 SUBDIR_DEPEND_libbsnmp= ${_libnetgraph}
 SUBDIR_DEPEND_libc++:= libcxxrt
-SUBDIR_DEPEND_libc= libcompiler_rt
+# libssp_nonshared doesn't need to be linked into libc on every arch, but it is
+# small enough to build that this bit of serialization is likely insignificant.
+SUBDIR_DEPEND_libc= libcompiler_rt libssp_nonshared
 SUBDIR_DEPEND_libcam= libsbuf
 SUBDIR_DEPEND_libcasper= libnv
 SUBDIR_DEPEND_libdevstat= libkvm

Modified: stable/12/lib/libc/Makefile.depend.options
==============================================================================
--- stable/12/lib/libc/Makefile.depend.options  Thu Jan 16 03:24:45 2020        
(r356774)
+++ stable/12/lib/libc/Makefile.depend.options  Thu Jan 16 03:38:06 2020        
(r356775)
@@ -3,6 +3,6 @@
 
 DIRDEPS_OPTIONS= SSP
 
-DIRDEPS.SSP.yes= gnu/lib/libssp/libssp_nonshared
+DIRDEPS.SSP.yes= lib/libssp_nonshared
 
 .include <dirdeps-options.mk>

Modified: stable/12/lib/libssp/fortify_stubs.c
==============================================================================
--- head/lib/libssp/fortify_stubs.c     Sat Jan  4 20:19:25 2020        
(r356356)
+++ stable/12/lib/libssp/fortify_stubs.c        Thu Jan 16 03:38:06 2020        
(r356775)
@@ -38,15 +38,15 @@ void        *__memcpy_chk(void *dst, const void *src, 
size_t 
     size_t dstlen);
 void   *__memset_chk(void *dst, int c, size_t len, size_t dstlen);
 int    __snprintf_chk(char *str, size_t maxlen, int flag, size_t strlen,
-    const char *fmt);
-int    __sprintf_chk(char *str, int flag, size_t strlen, const char *fmt);
+    const char *fmt, ...);
+int    __sprintf_chk(char *str, int flag, size_t strlen, const char *fmt, ...);
 char   *__stpcpy_chk(char *dst, const char *src, size_t dstlen);
 char   *__strcat_chk(char *dst, const char *src, size_t dstlen);
 char   *__strcpy_chk(char *dst, const char *src, size_t dstlen);
 char   *__strncat_chk(char *dst, const char *src, size_t len, size_t dstlen);
 char   *__strncpy_chk(char *dst, const char *src, size_t len, size_t dstlen);
-int    __vsnprintf_chk(char *str, size_t size, const char *format,
-    va_list ap);
+int    __vsnprintf_chk(char *str, size_t size, int flags, size_t len,
+    const char *format, va_list ap);
 int    __vsprintf_chk(char *str, int flag, size_t slen, const char *format,
     va_list ap);
 
@@ -69,14 +69,14 @@ __memset_chk(void *dst, int c, size_t len, size_t dstl
 
 int
 __snprintf_chk(char *str, size_t maxlen, int flag, size_t strlen,
-    const char *fmt)
+    const char *fmt, ...)
 {
 
        ABORT();
 }
 
 int
-__sprintf_chk(char *str, int flag, size_t strlen, const char *fmt)
+__sprintf_chk(char *str, int flag, size_t strlen, const char *fmt, ...)
 {
 
        ABORT();
@@ -118,8 +118,8 @@ __strncpy_chk(char *dst, const char *src, size_t len, 
 }
 
 int
-__vsnprintf_chk(char *str, size_t size, const char *format,
-    va_list ap)
+__vsnprintf_chk(char *str, size_t size, int flags, size_t len,
+    const char *format, va_list ap)
 {
 
        ABORT();

Modified: stable/12/lib/libsysdecode/Makefile.depend
==============================================================================
--- stable/12/lib/libsysdecode/Makefile.depend  Thu Jan 16 03:24:45 2020        
(r356774)
+++ stable/12/lib/libsysdecode/Makefile.depend  Thu Jan 16 03:38:06 2020        
(r356775)
@@ -7,7 +7,6 @@ DIRDEPS = \
        gnu/lib/libdialog \
        gnu/lib/libgomp \
        gnu/lib/libregex \
-       gnu/lib/libssp \
        gnu/lib/libstdc++ \
        gnu/lib/libsupc++ \
        include \
@@ -99,6 +98,7 @@ DIRDEPS = \
        lib/libsdp \
        lib/libsecureboot \
        lib/libsqlite3 \
+       lib/libssp \
        lib/libstdthreads \
        lib/libtacplus \
        lib/libthread_db \

Modified: stable/12/share/mk/local.dirdeps.mk
==============================================================================
--- stable/12/share/mk/local.dirdeps.mk Thu Jan 16 03:24:45 2020        
(r356774)
+++ stable/12/share/mk/local.dirdeps.mk Thu Jan 16 03:38:06 2020        
(r356775)
@@ -75,7 +75,7 @@ DIRDEPS_FILTER.xtras+= Nusr.bin/clang/clang.host
 .if ${DEP_RELDIR} == "lib/libc"
 DIRDEPS += lib/libc_nonshared
 .if ${MK_SSP:Uno} != "no" 
-DIRDEPS += gnu/lib/libssp/libssp_nonshared
+DIRDEPS += lib/libssp_nonshared
 .endif
 .else
 DIRDEPS_FILTER.xtras+= Nlib/libc_nonshared

Modified: stable/12/share/mk/local.gendirdeps.mk
==============================================================================
--- stable/12/share/mk/local.gendirdeps.mk      Thu Jan 16 03:24:45 2020        
(r356774)
+++ stable/12/share/mk/local.gendirdeps.mk      Thu Jan 16 03:38:06 2020        
(r356775)
@@ -7,7 +7,7 @@ GENDIRDEPS_HEADER= echo '\# ${FreeBSD:L:@v@$$$v$$ @:M*
 # local.dirdeps.mk will put them in if necessary
 GENDIRDEPS_FILTER+= \
        Nbin/cat.host \
-       Ngnu/lib/libssp/libssp_nonshared \
+       Nlib/libssp_nonshared \
        Ncddl/usr.bin/ctf* \
        Nlib/libc_nonshared \
        Ngnu/lib/csu \

Modified: stable/12/share/mk/src.libnames.mk
==============================================================================
--- stable/12/share/mk/src.libnames.mk  Thu Jan 16 03:24:45 2020        
(r356774)
+++ stable/12/share/mk/src.libnames.mk  Thu Jan 16 03:38:06 2020        
(r356775)
@@ -561,8 +561,8 @@ LIBDIALOGDIR=       ${OBJTOP}/gnu/lib/libdialog
 LIBGCOVDIR=    ${OBJTOP}/gnu/lib/libgcov
 LIBGOMPDIR=    ${OBJTOP}/gnu/lib/libgomp
 LIBGNUREGEXDIR=        ${OBJTOP}/gnu/lib/libregex
-LIBSSPDIR=     ${OBJTOP}/gnu/lib/libssp
-LIBSSP_NONSHAREDDIR=   ${OBJTOP}/gnu/lib/libssp/libssp_nonshared
+LIBSSPDIR=     ${OBJTOP}/lib/libssp
+LIBSSP_NONSHAREDDIR=   ${OBJTOP}/lib/libssp_nonshared
 LIBSUPCPLUSPLUSDIR=    ${OBJTOP}/gnu/lib/libsupc++
 LIBASN1DIR=    ${OBJTOP}/kerberos5/lib/libasn1
 LIBGSSAPI_KRB5DIR=     ${OBJTOP}/kerberos5/lib/libgssapi_krb5

Modified: stable/12/targets/pseudo/userland/gnu/Makefile.depend
==============================================================================
--- stable/12/targets/pseudo/userland/gnu/Makefile.depend       Thu Jan 16 
03:24:45 2020        (r356774)
+++ stable/12/targets/pseudo/userland/gnu/Makefile.depend       Thu Jan 16 
03:38:06 2020        (r356775)
@@ -12,8 +12,6 @@ DIRDEPS = \
        gnu/lib/libgcov \
        gnu/lib/libgomp \
        gnu/lib/libregex/doc \
-       gnu/lib/libssp \
-       gnu/lib/libssp/libssp_nonshared \
        gnu/lib/libstdc++ \
        gnu/lib/libsupc++ \
        gnu/usr.bin/binutils/ar \

Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Thu Jan 16 03:24:45 
2020        (r356774)
+++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Thu Jan 16 03:38:06 
2020        (r356775)
@@ -8317,41 +8317,6 @@ OLD_FILES+=usr/share/doc/pjdfstest/README
 OLD_DIRS+=usr/share/doc/pjdfstest
 .endif
 
-.if ${MK_SSP} == no
-OLD_LIBS+=lib/libssp.so.0
-OLD_FILES+=usr/include/ssp/ssp.h
-OLD_FILES+=usr/include/ssp/stdio.h
-OLD_FILES+=usr/include/ssp/string.h
-OLD_FILES+=usr/include/ssp/unistd.h
-OLD_FILES+=usr/lib/libssp.a
-OLD_FILES+=usr/lib/libssp.so
-OLD_FILES+=usr/lib/libssp_nonshared.a
-OLD_FILES+=usr/lib32/libssp.a
-OLD_FILES+=usr/lib32/libssp.so
-OLD_LIBS+=usr/lib32/libssp.so.0
-OLD_FILES+=usr/lib32/libssp_nonshared.a
-OLD_FILES+=usr/tests/lib/libc/ssp/Kyuafile
-OLD_FILES+=usr/tests/lib/libc/ssp/h_fgets
-OLD_FILES+=usr/tests/lib/libc/ssp/h_getcwd
-OLD_FILES+=usr/tests/lib/libc/ssp/h_gets
-OLD_FILES+=usr/tests/lib/libc/ssp/h_memcpy
-OLD_FILES+=usr/tests/lib/libc/ssp/h_memmove
-OLD_FILES+=usr/tests/lib/libc/ssp/h_memset
-OLD_FILES+=usr/tests/lib/libc/ssp/h_read
-OLD_FILES+=usr/tests/lib/libc/ssp/h_readlink
-OLD_FILES+=usr/tests/lib/libc/ssp/h_snprintf
-OLD_FILES+=usr/tests/lib/libc/ssp/h_sprintf
-OLD_FILES+=usr/tests/lib/libc/ssp/h_stpcpy
-OLD_FILES+=usr/tests/lib/libc/ssp/h_stpncpy
-OLD_FILES+=usr/tests/lib/libc/ssp/h_strcat
-OLD_FILES+=usr/tests/lib/libc/ssp/h_strcpy
-OLD_FILES+=usr/tests/lib/libc/ssp/h_strncat
-OLD_FILES+=usr/tests/lib/libc/ssp/h_strncpy
-OLD_FILES+=usr/tests/lib/libc/ssp/h_vsnprintf
-OLD_FILES+=usr/tests/lib/libc/ssp/h_vsprintf
-OLD_FILES+=usr/tests/lib/libc/ssp/ssp_test
-.endif
-
 .if ${MK_SYSCONS} == no
 OLD_FILES+=usr/share/syscons/fonts/INDEX.fonts
 OLD_FILES+=usr/share/syscons/fonts/armscii8-8x14.fnt
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to