mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "LeMay, Michael" <michael.lemay@intel.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
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	[thread overview]
Message-ID: <390CE752059EB848A71F4F676EBAB76D3AC26355@ORSMSX114.amr.corp.intel.com> (raw)

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 <michael.lemay@...el.com>
---
 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)
 	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<b) return 1;
+#endif
 
 	return 0;
 }
-- 
2.7.4



             reply	other threads:[~2016-10-28 19:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 19:56 LeMay, Michael [this message]
2016-11-01 22:30 ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=390CE752059EB848A71F4F676EBAB76D3AC26355@ORSMSX114.amr.corp.intel.com \
    --to=michael.lemay@intel.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).