diff mbox

GCC's -fsplit-stack disturbing Mach's vm_allocate

Message ID 20140411230449.GB7323@type.home.polyno.me
State New
Headers show

Commit Message

Samuel Thibault April 11, 2014, 11:04 p.m. UTC
Samuel Thibault, le Fri 11 Apr 2014 23:51:44 +0200, a écrit :
> So, do we really want to let munmap poke a hole at address 0 and thus
> let further vm_map() return address 0?

i.e. we could apply this:


Samuel

Comments

Samuel Thibault April 16, 2014, 9:22 p.m. UTC | #1
Samuel Thibault, le Sat 12 Apr 2014 01:04:49 +0200, a écrit :
> Samuel Thibault, le Fri 11 Apr 2014 23:51:44 +0200, a écrit :
> > So, do we really want to let munmap poke a hole at address 0 and thus
> > let further vm_map() return address 0?
> 
> i.e. we could apply this:

I have applied it.

Samuel
diff mbox

Patch

diff --git a/sysdeps/mach/munmap.c b/sysdeps/mach/munmap.c
index 57d99f9..a46e3f1 100644
--- a/sysdeps/mach/munmap.c
+++ b/sysdeps/mach/munmap.c
@@ -27,6 +27,11 @@  int
 __munmap (__ptr_t addr, size_t len)
 {
   kern_return_t err;
+  if (addr == 0)
+    {
+      errno = EINVAL;
+      return -1;
+    }
   if (err = __vm_deallocate (__mach_task_self (),
 			     (vm_address_t) addr, (vm_size_t) len))
     {