Page MenuHomeFreeBSD

D22943.id66072.diff
No OneTemporary

D22943.id66072.diff

Index: lib/Makefile
===================================================================
--- lib/Makefile
+++ lib/Makefile
@@ -18,6 +18,8 @@
${_libcplusplus} \
${_libcxxrt} \
libelf \
+ libssp \
+ libssp_nonshared \
msun
# The main list; please keep these sorted alphabetically.
Index: lib/libc/secure/stack_protector.c
===================================================================
--- lib/libc/secure/stack_protector.c
+++ lib/libc/secure/stack_protector.c
@@ -58,6 +58,7 @@
__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 @@
{
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 @@
* 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++) {
Index: lib/libssp/Makefile
===================================================================
--- /dev/null
+++ lib/libssp/Makefile
@@ -0,0 +1,15 @@
+# $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
+
+.include <bsd.lib.mk>
Index: lib/libssp/Symbol.map
===================================================================
--- /dev/null
+++ lib/libssp/Symbol.map
@@ -0,0 +1,9 @@
+/*
+ * $FreeBSD$
+ */
+
+LIBSSP_1.0 {
+ __chk_fail;
+ __stack_chk_fail;
+ __stack_chk_guard;
+};
Index: lib/libssp/Versions.def
===================================================================
--- /dev/null
+++ lib/libssp/Versions.def
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+LIBSSP_1.0 {
+};
Index: lib/libssp_nonshared/Makefile
===================================================================
--- /dev/null
+++ 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>
Index: lib/libssp_nonshared/libssp_nonshared.c
===================================================================
--- /dev/null
+++ 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();
+}

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 28, 1:18 PM (7 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24356517
Default Alt Text
D22943.id66072.diff (2 KB)

Event Timeline