From fe0d386cf33928c3b3839bc428f304d38e979803 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Fri, 14 Aug 2015 03:03:13 +0000 Subject: [PATCH] Move the stack protector to a new "secure" directory As part of the code refactoring to support FORTIFY_SOURCE we want a new subdirectory "secure" to keep the files related to security. Move the stack protector functions to this new directory. No functional change. Differential Review: https://reviews.freebsd.org/D3333 --- lib/libc/Makefile | 1 + lib/libc/secure/Makefile.inc | 12 ++++++++++++ lib/libc/secure/Symbol.map | 14 ++++++++++++++ lib/libc/{sys => secure}/stack_protector.c | 0 lib/libc/{sys => secure}/stack_protector_compat.c | 0 lib/libc/sys/Makefile.inc | 2 -- lib/libc/sys/Symbol.map | 3 --- 7 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 lib/libc/secure/Makefile.inc create mode 100644 lib/libc/secure/Symbol.map rename lib/libc/{sys => secure}/stack_protector.c (100%) rename lib/libc/{sys => secure}/stack_protector_compat.c (100%) diff --git a/lib/libc/Makefile b/lib/libc/Makefile index b6d3f9f96a3b..2f8865c16a05 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -95,6 +95,7 @@ NOASM= .include "${LIBC_SRCTOP}/stdtime/Makefile.inc" .include "${LIBC_SRCTOP}/string/Makefile.inc" .include "${LIBC_SRCTOP}/sys/Makefile.inc" +.include "${LIBC_SRCTOP}/secure/Makefile.inc" .include "${LIBC_SRCTOP}/rpc/Makefile.inc" .include "${LIBC_SRCTOP}/uuid/Makefile.inc" .include "${LIBC_SRCTOP}/xdr/Makefile.inc" diff --git a/lib/libc/secure/Makefile.inc b/lib/libc/secure/Makefile.inc new file mode 100644 index 000000000000..6f18bded1ff5 --- /dev/null +++ b/lib/libc/secure/Makefile.inc @@ -0,0 +1,12 @@ +# $FreeBSD$ +# +# libc sources related to security + +.PATH: ${LIBC_SRCTOP}/secure + +# Sources common to both syscall interfaces: +SRCS+= \ + stack_protector.c \ + stack_protector_compat.c + +SYM_MAPS+= ${LIBC_SRCTOP}/secure/Symbol.map diff --git a/lib/libc/secure/Symbol.map b/lib/libc/secure/Symbol.map new file mode 100644 index 000000000000..11bad3a22444 --- /dev/null +++ b/lib/libc/secure/Symbol.map @@ -0,0 +1,14 @@ +/* + * $FreeBSD$ + */ + +/* + * It'd be nice to have this automatically generated, but we don't + * know to what version they will eventually belong, so for now + * it has to be manual. + */ +FBSD_1.0 { + __chk_fail; + __stack_chk_fail; + __stack_chk_guard; +}; diff --git a/lib/libc/sys/stack_protector.c b/lib/libc/secure/stack_protector.c similarity index 100% rename from lib/libc/sys/stack_protector.c rename to lib/libc/secure/stack_protector.c diff --git a/lib/libc/sys/stack_protector_compat.c b/lib/libc/secure/stack_protector_compat.c similarity index 100% rename from lib/libc/sys/stack_protector_compat.c rename to lib/libc/secure/stack_protector_compat.c diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index e672b69e7a43..fad970c22f5e 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -21,8 +21,6 @@ PSEUDO+= _clock_gettime.o _gettimeofday.o # Sources common to both syscall interfaces: SRCS+= \ - stack_protector.c \ - stack_protector_compat.c \ __error.c \ interposing_table.c diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index a3a613e24a44..45833ab6bce4 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -56,7 +56,6 @@ FBSD_1.0 { bind; chdir; chflags; - __chk_fail; chmod; chown; chroot; @@ -281,8 +280,6 @@ FBSD_1.0 { sigwaitinfo; socket; socketpair; - __stack_chk_fail; - __stack_chk_guard; stat; statfs; swapoff;