From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10674 Path: news.gmane.org!.POSTED!not-for-mail From: "LeMay, Michael" Newsgroups: gmane.linux.lib.musl.general Subject: [RFC PATCH v2 1/4] disable check for buggy brk implementations when SafeStack is enabled Date: Fri, 28 Oct 2016 19:56:18 +0000 Message-ID: <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" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1477684627 23512 195.159.176.226 (28 Oct 2016 19:57:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 28 Oct 2016 19:57:07 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-10687-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 28 21:57:03 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 1c0DGS-0001xG-7F for gllmg-musl@m.gmane.org; Fri, 28 Oct 2016 21:56:32 +0200 Original-Received: (qmail 9277 invoked by uid 550); 28 Oct 2016 19:56:33 -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 9230 invoked from network); 28 Oct 2016 19:56:31 -0000 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,411,1473145200"; d="scan'208";a="895221678" Thread-Topic: [RFC PATCH v2 1/4] disable check for buggy brk implementations when SafeStack is enabled Thread-Index: AdIxVUo+AsfEqhmcQr6b0M0oMrK3wQ== Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.140] Xref: news.gmane.org gmane.linux.lib.musl.general:10674 Archived-At: 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 @@ =20 static int traverses_stack_p(uintptr_t old, uintptr_t new) { +#if !defined(__has_feature) || !__has_feature(safe_stack) const uintptr_t len =3D 8<<20; uintptr_t a, b; =20 @@ -23,6 +24,7 @@ static int traverses_stack_p(uintptr_t old, uintptr_t new= ) b =3D (uintptr_t)&b; a =3D b > len ? b-len : 0; if (new>a && old