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: Justus Winter <4winter at informatik dot uni-hamburg dot de>
- Cc: svante dot signell at gmail dot com, bug-hurd at gnu dot org, fotis dot koutoulakis at gmail dot com, Roland McGrath <roland at hack dot frob dot com>, Ian Lance Taylor <iant at google dot com>, gcc-patches at gcc dot gnu dot org, Thomas Schwinge <thomas at codesourcery dot com>
- Date: Fri, 2 May 2014 11:23:33 +0200
- Subject: Re: GCC's -fsplit-stack disturbing Mach's vm_allocate
- Authentication-results: sourceware.org; auth=none
- References: <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> <20140416220345 dot GZ5545 at type dot youpi dot perso dot aquilenet dot fr> <20140418080311 dot GA5626 at type dot bordeaux dot inria dot fr> <1398328750 dot 568 dot 74 dot camel at G3620 dot my dot own dot domain> <20140426065308 dot 26934 dot 76686 at thinkbox dot jade-hamburg dot de>
Justus Winter, le Sat 26 Apr 2014 08:53:08 +0200, a écrit :
> task130(pid1182)->vm_map (0 49880 0 1 133<--160(pid1182) 0 1 5 7 1) = 0 2453504
>
> We map that somewhere.
>
> task130(pid1182)->mach_port_deallocate (pn{ 25}) = 0
>
> Deallocate the port. Again, for some strange reason 133 == pn{ 25}.
>
> 158<--157(pid1182)->io_map_request () = 0 133<--162(pid1182) (null)
>
> Some more io_map.
>
> task130(pid1182)->vm_map (2498560 8192 0 0 133<--162(pid1182) 40960 1 3 7 1) = 0x3 ((os/kern) no space available)
> task130(pid1182)->vm_deallocate (2498560 8192) = 0
>
> Hum?
>
> task130(pid1182)->vm_map (2498560 8192 0 0 133<--162(pid1182) 40960 1 3 7 1) = 0 2498560
> task130(pid1182)->mach_port_deallocate (pn{ 25}) = 0
>
> Success!
See the logic in elf/dl-load.c's _dl_map_object_from_fd and
sysdeps/mach/hurd/mmap.c. _dl_map_object_from_fd first gets somewhere
to map the SO (first __mmap call), and then, if bss is big, it maps
anonymous pages for it with MAP_FIXED, replacing the bss part of the SO:
2453504 + 49880 = 0x2632d8
2498560 + 8192 = 0x264000
So this seems like just normal behavior.
Samuel