From patchwork Tue Mar 8 13:50:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nix X-Patchwork-Id: 11266 Received: (qmail 38668 invoked by alias); 8 Mar 2016 13:55:22 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 38607 invoked by uid 89); 8 Mar 2016 13:55:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.4 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=sk:static, Hx-spam-relays-external:sk:mail.es, H*r:sk:mail.es, HX-HELO:sk:mail.es X-HELO: mail.esperi.org.uk From: Nix To: libc-alpha@sourceware.org Subject: [PATCH 10/18] Link libc.so with libc_nonshared.a to pull in __stack_chk_fail_local. Date: Tue, 8 Mar 2016 13:50:56 +0000 Message-Id: <1457445064-7107-11-git-send-email-nix@esperi.org.uk> In-Reply-To: <1457445064-7107-1-git-send-email-nix@esperi.org.uk> References: <1457445064-7107-1-git-send-email-nix@esperi.org.uk> X-DCC--Metrics: spindle 1282; Body=2 Fuz1=2 Fuz2=2 From: Nick Alcock With this in place, we pull in __stack_chk_fail_local, which will be required by the next commit, and referenced by every stack- protected function in libc. Also prevent that function from being stack-protected itself: this makes no sense. v5: Better explanation. Add no-stack-protection of __stack_chk_fail_local etc. * Makerules $(common-objpfx)libc.so, $(common-objpfx)linkobj/libc.so): Add $(common-objpfx)libc_nonshared.a. * debug/Makefile (CFLAGS-stack_chk_fail.c): Use $(no-stack-protector). (CFLAGS-stack_chk_fail_local.c): Likewise. --- Makerules | 2 ++ debug/Makefile | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Makerules b/Makerules index 53eabfa..d369d78 100644 --- a/Makerules +++ b/Makerules @@ -674,6 +674,7 @@ $(common-objpfx)linkobj/libc.so: link-libc-deps = # empty # libraries. $(common-objpfx)libc.so: $(elf-objpfx)soinit.os \ $(common-objpfx)libc_pic.os$(libc_pic_clean) \ + $(common-objpfx)libc_nonshared.a \ $(elf-objpfx)sofini.os \ $(elf-objpfx)interp.os \ $(elf-objpfx)ld.so \ @@ -683,6 +684,7 @@ $(common-objpfx)libc.so: $(elf-objpfx)soinit.os \ $(common-objpfx)linkobj/libc.so: $(elf-objpfx)soinit.os \ $(common-objpfx)linkobj/libc_pic.a \ + $(common-objpfx)libc_nonshared.a \ $(elf-objpfx)sofini.os \ $(elf-objpfx)interp.os \ $(elf-objpfx)ld.so \ diff --git a/debug/Makefile b/debug/Makefile index 6b5f31e..2f506af 100644 --- a/debug/Makefile +++ b/debug/Makefile @@ -52,6 +52,12 @@ routines = backtrace backtracesyms backtracesymsfd noophooks \ $(static-only-routines) static-only-routines := warning-nop stack_chk_fail_local +# Building the stack-protector failure routines with stack protection +# makes no sense. + +CFLAGS-stack_chk_fail.c = $(no-stack-protector) +CFLAGS-stack_chk_fail_local.c = $(no-stack-protector) + CFLAGS-backtrace.c = -fno-omit-frame-pointer CFLAGS-sprintf_chk.c = $(libio-mtsafe) CFLAGS-snprintf_chk.c = $(libio-mtsafe)