public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Implement address space guards.
Date: Fri, 24 Aug 2018 13:09:00 -0000	[thread overview]
Message-ID: <20180824130934.66535.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=eb82d7086c08a92d15392a181673429c6db24a09

commit eb82d7086c08a92d15392a181673429c6db24a09
Author: kib <kib@FreeBSD.org>
Date:   Sat Jun 24 17:01:11 2017 +0000

    Implement address space guards.
    
    Guard, requested by the MAP_GUARD mmap(2) flag, prevents the reuse of
    the allocated address space, but does not allow instantiation of the
    pages in the range.  It is useful for more explicit support for usual
    two-stage reserve then commit allocators, since it prevents accidental
    instantiation of the mapping, e.g. by mprotect(2).
    
    Use guards to reimplement stack grow code.  Explicitely track stack
    grow area with the guard, including the stack guard page.  On stack
    grow, trivial shift of the guard map entry and stack map entry limits
    makes the stack expansion.  Move the code to detect stack grow and
    call vm_map_growstack(), from vm_fault() into vm_map_lookup().
    
    As result, it is impossible to get random mapping to occur in the
    stack grow area, or to overlap the stack guard page.
    
    Enable stack guard page by default.
    
    Reviewed by:	alc, markj
    Man page update reviewed by:	alc, bjk, emaste, markj, pho
    Tested by:	pho, Qualys
    Sponsored by:	The FreeBSD Foundation
    MFC after:	1 week
    Differential revision:	https://reviews.freebsd.org/D11306 (man pages)

Diff:
---
 newlib/libc/sys/rtems/include/sys/mman.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/newlib/libc/sys/rtems/include/sys/mman.h b/newlib/libc/sys/rtems/include/sys/mman.h
index 8aeed87..c099e22 100644
--- a/newlib/libc/sys/rtems/include/sys/mman.h
+++ b/newlib/libc/sys/rtems/include/sys/mman.h
@@ -90,6 +90,7 @@
 /*
  * Extended flags
  */
+#define	MAP_GUARD	 0x00002000 /* reserve but don't map address range */
 #define	MAP_EXCL	 0x00004000 /* for MAP_FIXED, fail if address is used */
 #define	MAP_NOCORE	 0x00020000 /* dont include these pages in a coredump */
 #define	MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */


                 reply	other threads:[~2018-08-24 13:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180824130934.66535.qmail@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).