FreeBSD Bugzilla – Attachment 210298 Details for
Bug 242950
[exp-run] replacing libssp with BSDL version
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
git(1) diff against base
libssp-switch.diff (text/plain), 12.57 KB, created by
Kyle Evans
on 2019-12-29 03:46:42 UTC
(
hide
)
Description:
git(1) diff against base
Filename:
MIME Type:
Creator:
Kyle Evans
Created:
2019-12-29 03:46:42 UTC
Size:
12.57 KB
patch
obsolete
>diff --git a/Makefile.inc1 b/Makefile.inc1 >index dfed06a2691..eb5e42d5016 100644 >--- a/Makefile.inc1 >+++ b/Makefile.inc1 >@@ -2786,8 +2786,8 @@ libraries: .MAKE .PHONY > # static libgcc.a prerequisite for shared libc > # > _prereq_libs= lib/libcompiler_rt >-.if ${MK_SSP} != "no" >-_prereq_libs+= gnu/lib/libssp/libssp_nonshared >+.if ${MK_SSP_SUPPORT} != "no" >+_prereq_libs+= lib/libssp_nonshared > .endif > > # These dependencies are not automatically generated: >diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc >index 41886a00862..8f3b2337740 100644 >--- a/ObsoleteFiles.inc >+++ b/ObsoleteFiles.inc >@@ -36,6 +36,15 @@ > # xargs -n1 | sort | uniq -d; > # done > >+# 20191228: gcc libssp removed >+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_DIRS+=usr/include/ssp >+OLD_LIBS+=usr/lib32/libssp.so.0 >+ > # 20191222: 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 >diff --git a/gnu/lib/Makefile b/gnu/lib/Makefile >index 2cbb80cc7dc..a4a19b704e3 100644 >--- a/gnu/lib/Makefile >+++ b/gnu/lib/Makefile >@@ -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" >diff --git a/lib/Makefile b/lib/Makefile >index 81612f01a0d..7727feeb9d0 100644 >--- a/lib/Makefile >+++ b/lib/Makefile >@@ -11,6 +11,7 @@ > SUBDIR_BOOTSTRAP= \ > csu \ > .WAIT \ >+ ${_libssp} \ > libc \ > libc_nonshared \ > libcompiler_rt \ >@@ -212,6 +213,13 @@ SUBDIR.${MK_OFED}+= ofed > SUBDIR.${MK_VERIEXEC}+= libveriexec > SUBDIR.${MK_ZFS}+= libbe > >+.if ${MK_SSP_SUPPORT} != "no" >+_libssp= \ >+ libssp \ >+ libssp_nonshared \ >+ .WAIT >+.endif >+ > .if !make(install) > SUBDIR_PARALLEL= > .endif >diff --git a/lib/libc/Makefile b/lib/libc/Makefile >index ea3879ece59..71f53ef1e8f 100644 >--- a/lib/libc/Makefile >+++ b/lib/libc/Makefile >@@ -31,7 +31,7 @@ CFLAGS+=-DNO__SCCSID -DNO__RCSID > > LIB=c > SHLIB_MAJOR= 7 >-.if ${MK_SSP} != "no" >+.if ${MK_SSP_SUPPORT} != "no" > SHLIB_LDSCRIPT=libc.ldscript > .else > SHLIB_LDSCRIPT=libc_nossp.ldscript >@@ -59,7 +59,7 @@ CFLAGS+=${CANCELPOINTS_CFLAGS} > LDFLAGS+= -nodefaultlibs > LIBADD+= compiler_rt > >-.if ${MK_SSP} != "no" >+.if ${MK_SSP_SUPPORT} != "no" > LIBADD+= ssp_nonshared > .endif > >diff --git a/lib/libc/secure/stack_protector.c b/lib/libc/secure/stack_protector.c >index 63c02cd9603..15460278502 100644 >--- a/lib/libc/secure/stack_protector.c >+++ b/lib/libc/secure/stack_protector.c >@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); > __attribute__((__constructor__, __used__)); > #endif > >+extern long __stack_chk_guard[8]; > extern int __sysctl(const int *name, u_int namelen, void *oldp, > size_t *oldlenp, void *newp, size_t newlen); > >@@ -73,8 +74,8 @@ __guard_setup(void) > { > static const int mib[2] = { CTL_KERN, KERN_ARND }; > volatile long tmp_stack_chk_guard[nitems(__stack_chk_guard)]; >- size_t len; >- int error, idx; >+ size_t idx, len; >+ int error; > > if (__stack_chk_guard[0] != 0) > return; >@@ -84,7 +85,8 @@ __guard_setup(void) > * data into a temporal array, then do manual volatile copy to > * not allow optimizer to call memcpy() behind us. > */ >- error = _elf_aux_info(AT_CANARY, (void *)tmp_stack_chk_guard, >+ error = _elf_aux_info(AT_CANARY, >+ __DEQUALIFY(void *, tmp_stack_chk_guard), > sizeof(tmp_stack_chk_guard)); > if (error == 0 && tmp_stack_chk_guard[0] != 0) { > for (idx = 0; idx < nitems(__stack_chk_guard); idx++) { >diff --git a/lib/libc/tests/Makefile b/lib/libc/tests/Makefile >index 11c3a635339..7066c7e5dd2 100644 >--- a/lib/libc/tests/Makefile >+++ b/lib/libc/tests/Makefile >@@ -34,7 +34,7 @@ TESTS_SUBDIRS+= iconv > TESTS_SUBDIRS+= locale > .endif > >-.if ${MK_SSP} != "no" >+.if ${MK_SSP_SUPPORT} != "no" > TESTS_SUBDIRS+= ssp > .endif > >diff --git a/lib/libssp/Makefile b/lib/libssp/Makefile >new file mode 100644 >index 00000000000..91fd27695ac >--- /dev/null >+++ b/lib/libssp/Makefile >@@ -0,0 +1,17 @@ >+# $FreeBSD$ >+ >+PACKAGE= clibs >+SHLIBDIR?= /lib >+SHLIB= ssp >+SHLIB_MAJOR= 1 >+ >+VERSION_DEF= ${.CURDIR}/Versions.def >+SYMBOL_MAPS= ${.CURDIR}/Symbol.map >+ >+.PATH: ${SRCTOP}/lib/libc/secure >+CFLAGS+= -I${SRCTOP}/lib/libc/include -DIN_LIBSSP >+SRCS= stack_protector.c fortify_stubs.c >+ >+CFLAGS.fortify_stubs.c= -Wno-unused-parameter >+ >+.include <bsd.lib.mk> >diff --git a/lib/libssp/Symbol.map b/lib/libssp/Symbol.map >new file mode 100644 >index 00000000000..271749f9c95 >--- /dev/null >+++ b/lib/libssp/Symbol.map >@@ -0,0 +1,22 @@ >+/* >+ * $FreeBSD$ >+ */ >+ >+LIBSSP_1.0 { >+ __chk_fail; >+ __stack_chk_fail; >+ __stack_chk_guard; >+ >+ /* Currently unsupported: _FORTIFY_SOURCE symbols. */ >+ __memcpy_chk; >+ __memset_chk; >+ __snprintf_chk; >+ __sprintf_chk; >+ __stpcpy_chk; >+ __strcat_chk; >+ __strcpy_chk; >+ __strncat_chk; >+ __strncpy_chk; >+ __vsnprintf_chk; >+ __vsprintf_chk; >+}; >diff --git a/lib/libssp/Versions.def b/lib/libssp/Versions.def >new file mode 100644 >index 00000000000..bbad6a02d00 >--- /dev/null >+++ b/lib/libssp/Versions.def >@@ -0,0 +1,4 @@ >+# $FreeBSD$ >+ >+LIBSSP_1.0 { >+}; >diff --git a/lib/libssp/fortify_stubs.c b/lib/libssp/fortify_stubs.c >new file mode 100644 >index 00000000000..f68b07f1de9 >--- /dev/null >+++ b/lib/libssp/fortify_stubs.c >@@ -0,0 +1,134 @@ >+/*- >+ * SPDX-License-Identifier: BSD-2-Clause >+ * >+ * Copyright (c) 2019 Kyle Evans <kevans@FreeBSD.org> >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND >+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE >+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ */ >+ >+#include <sys/cdefs.h> >+__FBSDID("$FreeBSD$"); >+ >+#include <sys/types.h> >+ >+#include <stdarg.h> >+#include <stdlib.h> >+ >+/* Signatures grabbed from LSB Core Specification 4.1 */ >+void *__memcpy_chk(void *dst, const void *src, size_t len, >+ 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); >+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 __vsprintf_chk(char *str, int flag, size_t slen, const char *format, >+ va_list ap); >+ >+#define ABORT() abort2("_FORTIFY_SOURCE not supported", 0, NULL) >+ >+void * >+__memcpy_chk(void *dst, const void *src, size_t len, >+ size_t dstlen) >+{ >+ >+ ABORT(); >+} >+ >+void * >+__memset_chk(void *dst, int c, size_t len, size_t dstlen) >+{ >+ >+ ABORT(); >+} >+ >+int >+__snprintf_chk(char *str, size_t maxlen, int flag, size_t strlen, >+ const char *fmt) >+{ >+ >+ ABORT(); >+} >+ >+int >+__sprintf_chk(char *str, int flag, size_t strlen, const char *fmt) >+{ >+ >+ ABORT(); >+} >+ >+char * >+__stpcpy_chk(char *dst, const char *src, size_t dstlen) >+{ >+ >+ ABORT(); >+} >+ >+char * >+__strcat_chk(char *dst, const char *src, size_t dstlen) >+{ >+ >+ ABORT(); >+} >+ >+char * >+__strcpy_chk(char *dst, const char *src, size_t dstlen) >+{ >+ >+ ABORT(); >+} >+ >+char * >+__strncat_chk(char *dst, const char *src, size_t len, size_t dstlen) >+{ >+ >+ ABORT(); >+} >+ >+char * >+__strncpy_chk(char *dst, const char *src, size_t len, size_t dstlen) >+{ >+ >+ ABORT(); >+} >+ >+int >+__vsnprintf_chk(char *str, size_t size, const char *format, >+ va_list ap) >+{ >+ >+ ABORT(); >+} >+ >+int >+__vsprintf_chk(char *str, int flag, size_t slen, const char *format, >+ va_list ap) >+{ >+ >+ ABORT(); >+} >diff --git a/lib/libssp_nonshared/Makefile b/lib/libssp_nonshared/Makefile >new file mode 100644 >index 00000000000..65ef1712c4d >--- /dev/null >+++ b/lib/libssp_nonshared/Makefile >@@ -0,0 +1,10 @@ >+# $FreeBSD$ >+ >+PACKAGE= clibs >+LIB= ssp_nonshared >+NO_PIC= >+MK_PROFILE= no >+ >+SRCS= libssp_nonshared.c >+ >+.include <bsd.lib.mk> >diff --git a/lib/libssp_nonshared/libssp_nonshared.c b/lib/libssp_nonshared/libssp_nonshared.c >new file mode 100644 >index 00000000000..ab07badbf9f >--- /dev/null >+++ b/lib/libssp_nonshared/libssp_nonshared.c >@@ -0,0 +1,17 @@ >+/* >+ * Written by Alexander Kabaev <kan@FreeBSD.org> >+ * The file is in public domain. >+ */ >+ >+#include <sys/cdefs.h> >+__FBSDID("$FreeBSD$"); >+ >+void __stack_chk_fail(void); >+void __stack_chk_fail_local(void); >+ >+void __hidden >+__stack_chk_fail_local(void) >+{ >+ >+ __stack_chk_fail(); >+} >diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk >index b0f6bfd6127..e2c3bddc413 100644 >--- a/share/mk/local.dirdeps.mk >+++ b/share/mk/local.dirdeps.mk >@@ -74,8 +74,8 @@ DIRDEPS_FILTER.xtras+= Nusr.bin/clang/clang.host > # this is how we can handle optional dependencies > .if ${DEP_RELDIR} == "lib/libc" > DIRDEPS += lib/libc_nonshared >-.if ${MK_SSP:Uno} != "no" >-DIRDEPS += gnu/lib/libssp/libssp_nonshared >+.if ${MK_SSP_SUPPORT:Uno} != "no" >+DIRDEPS += lib/libssp_nonshared > .endif > .else > DIRDEPS_FILTER.xtras+= Nlib/libc_nonshared >diff --git a/share/mk/local.gendirdeps.mk b/share/mk/local.gendirdeps.mk >index 71a7a3cbc00..cb7e4df66d7 100644 >--- a/share/mk/local.gendirdeps.mk >+++ b/share/mk/local.gendirdeps.mk >@@ -7,7 +7,7 @@ GENDIRDEPS_HEADER= echo '\# ${FreeBSD:L:@v@$$$v$$ @:M*F*}'; > # 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 \ >diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk >index 0fc2389190a..e4ff7013d7d 100644 >--- a/share/mk/src.libnames.mk >+++ b/share/mk/src.libnames.mk >@@ -566,8 +566,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 >diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk >index 950965a93e0..f53797eea0a 100644 >--- a/share/mk/src.opts.mk >+++ b/share/mk/src.opts.mk >@@ -222,6 +222,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \ > CLANG_FULL/CLANG \ > LOADER_VERIEXEC/BEARSSL \ > LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \ >+ SSP_SUPPORT/SSP \ > VERIEXEC/BEARSSL \ > > # MK_*_SUPPORT options which default to "yes" unless their corresponding >diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc >index edb28ebf6c6..7cee03f126a 100644 >--- a/tools/build/mk/OptionalObsoleteFiles.inc >+++ b/tools/build/mk/OptionalObsoleteFiles.inc >@@ -8646,18 +8646,14 @@ 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 >+.if ${MK_SSP_SUPPORT} == no >+OLD_LIBS+=lib/libssp.so.1 > 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_LIBS+=usr/lib32/libssp.so.1 > OLD_FILES+=usr/lib32/libssp_nonshared.a > OLD_FILES+=usr/tests/lib/libc/ssp/Kyuafile > OLD_FILES+=usr/tests/lib/libc/ssp/h_fgets
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 242950
: 210298