From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10526 Path: news.gmane.org!.POSTED!not-for-mail From: "LeMay, Michael" Newsgroups: gmane.linux.lib.musl.general Subject: [RFC PATCH 3/7] disable check for buggy brk implementations when SafeStack is enabled Date: Tue, 27 Sep 2016 15:36:09 -0700 Message-ID: <3f8d9836-e1ed-183c-5b51-e6407ad1fcff@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 1475015803 30354 195.159.176.226 (27 Sep 2016 22:36:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Sep 2016 22:36:43 +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-10539-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 28 00:36:40 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 1bp0z8-0005Hp-UQ for gllmg-musl@m.gmane.org; Wed, 28 Sep 2016 00:36:23 +0200 Original-Received: (qmail 1588 invoked by uid 550); 27 Sep 2016 22:36:23 -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 1555 invoked from network); 27 Sep 2016 22:36:22 -0000 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,407,1470726000"; d="scan'208";a="14389604" Xref: news.gmane.org gmane.linux.lib.musl.general:10526 Archived-At: The check relies on comparing the addresses of stack-allocated objects to addresses returned by the brk syscall. Segmentation-hardened SafeStack moves the allocations to heap locations, breaking the check. This patch disables the check when segmentation-hardened SafeStack is enabled. Signed-off-by: Michael LeMay --- src/malloc/expand_heap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/malloc/expand_heap.c b/src/malloc/expand_heap.c index d8c0be7..ace2b6a 100644 --- a/src/malloc/expand_heap.c +++ b/src/malloc/expand_heap.c @@ -13,6 +13,7 @@ static int traverses_stack_p(uintptr_t old, uintptr_t new) { +#if !SAFE_STACK const uintptr_t len = 8<<20; uintptr_t a, b; @@ -23,6 +24,7 @@ static int traverses_stack_p(uintptr_t old, uintptr_t new) b = (uintptr_t)&b; a = b > len ? b-len : 0; if (new>a && old