This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Question about memory mappings with inaccessible permissions
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-help at sourceware dot org
- Date: Thu, 8 Oct 2015 16:03:10 -0300
- Subject: Re: Question about memory mappings with inaccessible permissions
- Authentication-results: sourceware.org; auth=none
- References: <560C1560 dot 70104 at cs dot fsu dot edu> <5616A3E6 dot 9080704 at cs dot fsu dot edu>
My understanding they are from elf/dl-map-segments.h:72 (_dl_map_segments)
and the function is responsible to load the ELF segments in memory from a
file descriptor. And my understanding of setting the holes with PROT_NONE
permission is to allow the kernel to allocate pages that won't be used
anywhere.
On 08-10-2015 14:12, Randolph Langley wrote:
>
>
> Does anyone have any ideas about this? Is this behavior intentional, or is it unintended?
>
> If intentional, then why is it desirable (is it some sort of guard?)
>
> Thanks,
>
> Randolph
>
>
>
>
> On 09/30/2015 01:01 PM, Randolph Langley wrote:
>>
>> I am curious about some of the memory mappings that I am seeing.
>>
>> Here's an example from a bash process:
>>
>> $ cat /proc/4012/maps
>> 00400000-004ef000 r-xp 00000000 08:11
>> 3670022 /bin/bash
>> 006ef000-006f0000 r--p 000ef000 08:11
>> 3670022 /bin/bash
>> 006f0000-006f9000 rw-p 000f0000 08:11
>> 3670022 /bin/bash
>> 006f9000-006ff000 rw-p 00000000 00:00 0
>> 01de9000-02038000 rw-p 00000000 00:00
>> 0 [heap]
>> 7fbd5cde6000-7fbd5cdf1000 r-xp 00000000 08:11 2363469
>> /lib/x86_64-linux-gnu/libnss_files-2.19.so
>> 7fbd5cdf1000-7fbd5cff0000 ---p 0000b000 08:11 2363469
>> /lib/x86_64-linux-gnu/libnss_files-2.19.so
>> 7fbd5cff0000-7fbd5cff1000 r--p 0000a000 08:11 2363469
>> /lib/x86_64-linux-gnu/libnss_files-2.19.so
>> 7fbd5cff1000-7fbd5cff2000 rw-p 0000b000 08:11 2363469
>> /lib/x86_64-linux-gnu/libnss_files-2.19.so
>> 7fbd5cff2000-7fbd5cffd000 r-xp 00000000 08:11 2363596
>> /lib/x86_64-linux-gnu/libnss_nis-2.19.so
>> 7fbd5cffd000-7fbd5d1fc000 ---p 0000b000 08:11 2363596
>> /lib/x86_64-linux-gnu/libnss_nis-2.19.so
>> 7fbd5d1fc000-7fbd5d1fd000 r--p 0000a000 08:11 2363596
>> /lib/x86_64-linux-gnu/libnss_nis-2.19.so
>> 7fbd5d1fd000-7fbd5d1fe000 rw-p 0000b000 08:11 2363596
>> /lib/x86_64-linux-gnu/libnss_nis-2.19.so
>> 7fbd5d1fe000-7fbd5d215000 r-xp 00000000 08:11
>> 2363567 /lib/x86_64-linux-gnu/libnsl-2.19.so
>> 7fbd5d215000-7fbd5d414000 ---p 00017000 08:11
>> 2363567 /lib/x86_64-linux-gnu/libnsl-2.19.so
>> 7fbd5d414000-7fbd5d415000 r--p 00016000 08:11
>> 2363567 /lib/x86_64-linux-gnu/libnsl-2.19.so
>> 7fbd5d415000-7fbd5d416000 rw-p 00017000 08:11
>> 2363567 /lib/x86_64-linux-gnu/libnsl-2.19.so
>> 7fbd5d416000-7fbd5d418000 rw-p 00000000 00:00 0
>> 7fbd5d418000-7fbd5d421000 r-xp 00000000 08:11 2363566
>> /lib/x86_64-linux-gnu/libnss_compat-2.19.so
>> 7fbd5d421000-7fbd5d620000 ---p 00009000 08:11 2363566
>> /lib/x86_64-linux-gnu/libnss_compat-2.19.so
>> 7fbd5d620000-7fbd5d621000 r--p 00008000 08:11 2363566
>> /lib/x86_64-linux-gnu/libnss_compat-2.19.so
>> 7fbd5d621000-7fbd5d622000 rw-p 00009000 08:11 2363566
>> /lib/x86_64-linux-gnu/libnss_compat-2.19.so
>> 7fbd5d622000-7fbd5dabc000 r--p 00000000 08:11
>> 661812 /usr/lib/locale/locale-archive
>> 7fbd5dabc000-7fbd5dc77000 r-xp 00000000 08:11
>> 2363579 /lib/x86_64-linux-gnu/libc-2.19.so
>> 7fbd5dc77000-7fbd5de76000 ---p 001bb000 08:11
>> 2363579 /lib/x86_64-linux-gnu/libc-2.19.so
>> 7fbd5de76000-7fbd5de7a000 r--p 001ba000 08:11
>> 2363579 /lib/x86_64-linux-gnu/libc-2.19.so
>> 7fbd5de7a000-7fbd5de7c000 rw-p 001be000 08:11
>> 2363579 /lib/x86_64-linux-gnu/libc-2.19.so
>> 7fbd5de7c000-7fbd5de81000 rw-p 00000000 00:00 0
>> 7fbd5de81000-7fbd5de84000 r-xp 00000000 08:11
>> 2363545 /lib/x86_64-linux-gnu/libdl-2.19.so
>> 7fbd5de84000-7fbd5e083000 ---p 00003000 08:11
>> 2363545 /lib/x86_64-linux-gnu/libdl-2.19.so
>> [ .... ]
>>
>>
>> Several of these have permissions of "---p"; that is, there is no permission to read, write, or execute these mappings.
>>
>> Can anyone explain why these inaccessible mappings exist? If so, are these useful in some way? I have casually experimented with munmap(2)-ing these, and so far I haven't seen any dire effects.
>>
>> Thanks,
>>
>> Randolph
>>
>