/proc/$ pid/maps在x86_64 linux上显示没有rwx权限的页面 [英] /proc/$pid/maps shows pages with no rwx permissions on x86_64 linux

查看:287
本文介绍了/proc/$ pid/maps在x86_64 linux上显示没有rwx权限的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

/proc/$pid/maps显示在x86_64 linux上没有rwx权限的页面. 我注意到,当我在64位linux上读取/proc/$pid/maps时,我看到的内存页面没有权限,但是在32位linux上,它们不存在.

/proc/$pid/maps shows pages with no rwx permissions on x86_64 linux. I noticed that when I read /proc/$pid/maps at 64bit linux I have memory pages that have no permissions, but in a 32bit linux, they aren't there.

我正在尝试监视进程的内存使用情况,但我感到困惑.为什么会有没有rwx权限的页面.他们正在消耗我的记忆!

I’m trying to monitor the memory usage of my process, but Im confused. Why are there pages with no rwx privileges. They are consuming my memory!

这是"top"的64位linux输出的摘录.

This is a snippet of the output of a 64bit linux for ‘top’

% cat /proc/21367/maps

3154200000-315420d000 r-xp 00000000 fd:00 4835776 /lib64/libproc-3.2.7.so <br/>
315420d000-315440d000 **---p** 0000d000 fd:00 4835776 /lib64/libproc-3.2.7.so <br/>
315440d000-315440e000 rw-p 0000d000 fd:00 4835776 /lib64/libproc-3.2.7.so

请告知.

推荐答案

这些映射用于共享库:

通常,对于每个加载的共享库,我们将有四个映射:

In general for each shared library loaded we will have four mappings:

3b7cc00000-3b7cd86000 r-xp 00000000 fd:00 661350            /lib64/libc-2.12.so
3b7cd86000-3b7cf86000 ---p 00186000 fd:00 661350            /lib64/libc-2.12.so
3b7cf86000-3b7cf8a000 r--p 00186000 fd:00 661350            /lib64/libc-2.12.so
3b7cf8a000-3b7cf8b000 rw-p 0018a000 fd:00 661350            /lib64/libc-2.12.so

第一个是具有可执行权限的代码段,第二个是PROT_NONE(无权限)映射,最后两个是数据段(只读和读写).

The first one is the code segment with executable permissions, the second one the PROT_NONE (no permissions) mapping, and the last two ones the data segment (read only part and read write).

创建PROT_NONE映射的目的是保持库可有效共享并标记保护页,以便可以捕获缓冲区溢出.

The PROT_NONE mappings are created to do with keeping libraries efficiently sharable and to mark guard pages so buffer overflows can be catched.

请记住,这些映射仅使用虚拟地址空间的一部分,但实际上并没有消耗系统内存.

Just keep in mind that these mappings are only using part of the virtual address space but they are not actually consuming the systems memory.

在这里您可以找到完整的说明:

Here you can find a complete explanation:

http://www.greenend.org.uk/rjk/tech/dataseg.html

这篇关于/proc/$ pid/maps在x86_64 linux上显示没有rwx权限的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆