From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10691 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [RFC PATCH v2 1/4] disable check for buggy brk implementations when SafeStack is enabled Date: Tue, 1 Nov 2016 23:30:25 +0100 Message-ID: <20161101223025.GG5749@port70.net> References: <390CE752059EB848A71F4F676EBAB76D3AC26355@ORSMSX114.amr.corp.intel.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1478039449 3714 195.159.176.226 (1 Nov 2016 22:30:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 Nov 2016 22:30:49 +0000 (UTC) User-Agent: Mutt/1.6.0 (2016-04-01) Cc: "musl@lists.openwall.com" To: "LeMay, Michael" Original-X-From: musl-return-10704-gllmg-musl=m.gmane.org@lists.openwall.com Tue Nov 01 23:30:44 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 1c1hZl-0007uv-PW for gllmg-musl@m.gmane.org; Tue, 01 Nov 2016 23:30:37 +0100 Original-Received: (qmail 3553 invoked by uid 550); 1 Nov 2016 22:30:37 -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 3535 invoked from network); 1 Nov 2016 22:30:37 -0000 Mail-Followup-To: "LeMay, Michael" , "musl@lists.openwall.com" Content-Disposition: inline In-Reply-To: <390CE752059EB848A71F4F676EBAB76D3AC26355@ORSMSX114.amr.corp.intel.com> Xref: news.gmane.org gmane.linux.lib.musl.general:10691 Archived-At: * LeMay, Michael [2016-10-28 19:56:18 +0000]: > The check relies on comparing the addresses of stack-allocated objects > to addresses returned by the brk syscall. SafeStack moves the > allocations to the unsafe stack, breaking the check. This patch > disables the check when 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..af51451 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 !defined(__has_feature) || !__has_feature(safe_stack) preprocessing this fails on any released version of gcc https://godbolt.org/g/hHWEzI if __has_feature is not defined it expands to 0 and 0(safe_stack) is invalid syntax. e.g. this works: #ifdef __has_feature #if __has_feature(safe_stack) #define HAS_SAFE_STACK 1 #endif #endif > 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 +#endif > > return 0; > } > -- > 2.7.4