public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] hurd: Map brk non-executable
@ 2023-07-02 23:38 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-07-02 23:38 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4b5e576fc21931969c0a1b53fdaf7ce3bfcebb86

commit 4b5e576fc21931969c0a1b53fdaf7ce3bfcebb86
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Mon Jun 26 02:17:48 2023 +0300

    hurd: Map brk non-executable
    
    The rest of the heap (backed by individual pages) is already mapped RW.
    Mapping these pages RWX presents a security hazard.
    
    Also, in another branch memory gets allocated using vm_allocate, which
    sets memory protection to VM_PROT_DEFAULT (which is RW). The mismatch
    between protections prevents Mach from coalescing the VM map entries.
    
    Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
    Message-Id: <20230625231751.404120-2-bugaevc@gmail.com>

Diff:
---
 sysdeps/mach/hurd/brk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
index f1349495f5..3a335194f5 100644
--- a/sysdeps/mach/hurd/brk.c
+++ b/sysdeps/mach/hurd/brk.c
@@ -106,7 +106,7 @@ _hurd_set_brk (vm_address_t addr)
 	/* First finish allocation.  */
 	err = __vm_protect (__mach_task_self (), pagebrk,
 			    alloc_start - pagebrk, 0,
-			    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
+			    VM_PROT_READ|VM_PROT_WRITE);
       if (! err)
 	_hurd_brk = alloc_start;
 
@@ -120,7 +120,7 @@ _hurd_set_brk (vm_address_t addr)
   else
     /* Make the memory accessible.  */
     err = __vm_protect (__mach_task_self (), pagebrk, pagend - pagebrk,
-			0, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
+			0, VM_PROT_READ|VM_PROT_WRITE);
 
   if (err)
     return __hurd_fail (err);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-02 23:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-02 23:38 [glibc] hurd: Map brk non-executable Samuel Thibault

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).