This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: GCC's -fsplit-stack disturbing Mach's vm_allocate
- From: Samuel Thibault <samuel dot thibault at gnu dot org>
- To: Thomas Schwinge <thomas at codesourcery dot com>, svante dot signell at gmail dot com, Ian Lance Taylor <iant at google dot com>, gcc-patches at gcc dot gnu dot org, bug-hurd at gnu dot org, fotis dot koutoulakis at gmail dot com, Roland McGrath <roland at hack dot frob dot com>
- Date: Sat, 12 Apr 2014 01:04:49 +0200
- Subject: Re: GCC's -fsplit-stack disturbing Mach's vm_allocate
- Authentication-results: sourceware.org; auth=none
- References: <8761x7nkks dot fsf at kepler dot schwinge dot homeip dot net> <20130621231655 dot 24D002C14C at topped-with-meat dot com> <87r4fumx2g dot fsf at kepler dot schwinge dot homeip dot net> <CAKOQZ8wZOf8MBdVKiyDcggFBs3A48+QckAoB7XJm+b+E3rkAxQ at mail dot gmail dot com> <87ip10o90k dot fsf at kepler dot schwinge dot homeip dot net> <20140404191416 dot GG5350 at type> <1397027146 dot 1276 dot 29 dot camel at G3620 dot my dot own dot domain> <87fvln6jjp dot fsf at schwinge dot name> <20140411215144 dot GX7323 at type dot home dot polyno dot me>
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:
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))
{
Samuel