From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10530 Path: news.gmane.org!.POSTED!not-for-mail From: "LeMay, Michael" Newsgroups: gmane.linux.lib.musl.general Subject: [RFC PATCH 7/7] add compiler flags to enable SafeStack Date: Tue, 27 Sep 2016 15:39:17 -0700 Message-ID: <61ee0149-88a1-0e3f-06f2-93c999177777@intel.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1475015984 15230 195.159.176.226 (27 Sep 2016 22:39:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Sep 2016 22:39:44 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 To: "musl@lists.openwall.com" Original-X-From: musl-return-10543-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 28 00:39:39 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1bp12A-0002Wk-Vj for gllmg-musl@m.gmane.org; Wed, 28 Sep 2016 00:39:31 +0200 Original-Received: (qmail 5972 invoked by uid 550); 27 Sep 2016 22:39:31 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 5946 invoked from network); 27 Sep 2016 22:39:29 -0000 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,407,1470726000"; d="scan'208";a="14390175" Xref: news.gmane.org gmane.linux.lib.musl.general:10530 Archived-At: This adds the necessary compiler flags to build a segmentation-hardened SafeStack runtime for 32-bit x86 Linux programs with LLVM Clang. Signed-off-by: Michael LeMay --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index ec54880..b4203bb 100644 --- a/Makefile +++ b/Makefile @@ -128,6 +128,14 @@ NOSSP_SRCS = $(wildcard crt/*.c) \ ldso/dlstart.c ldso/dynlink.c $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP) +ifeq ($(SAFE_STACK),yes) + +CFLAGS_SAFE_STACK = -DSAFE_STACK=1 -fsanitize=safe-stack -fruntime-init -mseparate-stack-seg +NON_CRT_OBJS = $(filter-out $(CRT_OBJS),$(ALL_OBJS)) +$(NON_CRT_OBJS) $(NON_CRT_OBJS:%.o=%.lo): CFLAGS_ALL += $(CFLAGS_SAFE_STACK) + +endif + $(CRT_OBJS): CFLAGS_ALL += -DCRT $(LOBJS) $(LDSO_OBJS): CFLAGS_ALL += -fPIC -- 2.7.4