svn commit: r356775 - in stable: 11 11/gnu/lib 11/lib 11/lib/libssp 11/lib/libssp_nonshared 11/share/mk 11/targets/pseudo/userland/gnu 11/tools/build/mk 12 12/gnu/lib 12/lib 12/lib/libc 12/lib/libs...

Kyle Evans kevans at FreeBSD.org
Thu Jan 16 03:38:09 UTC 2020


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/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)

Changes in other areas also in this revision:
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)

Modified: stable/11/Makefile.inc1
==============================================================================
--- stable/11/Makefile.inc1	Thu Jan 16 03:24:45 2020	(r356774)
+++ stable/11/Makefile.inc1	Thu Jan 16 03:38:06 2020	(r356775)
@@ -2114,7 +2114,7 @@ libraries: .MAKE .PHONY
 #
 # static libgcc.a prerequisite for shared libc
 #
-_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
+_prereq_libs= lib/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
 
 # These dependencies are not automatically generated:
 #

Modified: stable/11/ObsoleteFiles.inc
==============================================================================
--- stable/11/ObsoleteFiles.inc	Thu Jan 16 03:24:45 2020	(r356774)
+++ stable/11/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
+
 # 20190723: new clang import which bumps version from 8.0.0 to 8.0.1.
 OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/asan_interface.h

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

Modified: stable/11/lib/Makefile
==============================================================================
--- stable/11/lib/Makefile	Thu Jan 16 03:24:45 2020	(r356774)
+++ stable/11/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.
@@ -136,7 +138,9 @@ SUBDIR_DEPEND_libatm= libmd
 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/11/lib/libssp/fortify_stubs.c
==============================================================================
--- head/lib/libssp/fortify_stubs.c	Sat Jan  4 20:19:25 2020	(r356356)
+++ stable/11/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/11/share/mk/local.dirdeps.mk
==============================================================================
--- stable/11/share/mk/local.dirdeps.mk	Thu Jan 16 03:24:45 2020	(r356774)
+++ stable/11/share/mk/local.dirdeps.mk	Thu Jan 16 03:38:06 2020	(r356775)
@@ -63,7 +63,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/11/share/mk/local.gendirdeps.mk
==============================================================================
--- stable/11/share/mk/local.gendirdeps.mk	Thu Jan 16 03:24:45 2020	(r356774)
+++ stable/11/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 \
 	Ntargets/pseudo/stage* \

Modified: stable/11/share/mk/src.libnames.mk
==============================================================================
--- stable/11/share/mk/src.libnames.mk	Thu Jan 16 03:24:45 2020	(r356774)
+++ stable/11/share/mk/src.libnames.mk	Thu Jan 16 03:38:06 2020	(r356775)
@@ -501,8 +501,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/11/targets/pseudo/userland/gnu/Makefile.depend
==============================================================================
--- stable/11/targets/pseudo/userland/gnu/Makefile.depend	Thu Jan 16 03:24:45 2020	(r356774)
+++ stable/11/targets/pseudo/userland/gnu/Makefile.depend	Thu Jan 16 03:38:06 2020	(r356775)
@@ -15,8 +15,6 @@ DIRDEPS = \
 	gnu/lib/libreadline/history/doc \
 	gnu/lib/libreadline/readline/doc \
 	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/11/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc	Thu Jan 16 03:24:45 2020	(r356774)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc	Thu Jan 16 03:38:06 2020	(r356775)
@@ -7636,41 +7636,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


More information about the svn-src-all mailing list