
{"id":7006,"date":"2012-03-29T13:21:31","date_gmt":"2012-03-29T13:21:31","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=7006"},"modified":"2012-03-29T13:21:31","modified_gmt":"2012-03-29T13:21:31","slug":"maps-memory-maps-to-executables-and-library-files-2","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2012\/03\/29\/maps-memory-maps-to-executables-and-library-files-2\/","title":{"rendered":"maps   Memory maps to executables and library files"},"content":{"rendered":"<h4><u> UNIX Parameter <\/u><\/h4>\n<pre>\n$sudo cat \/proc\/1\/maps\n[sudo] password for jeffrin:\n00400000-00409000 r-xp 00000000 08:01 6070276                            \/sbin\/init\n00608000-00609000 r--p 00008000 08:01 6070276                            \/sbin\/init\n00609000-0060a000 rw-p 00009000 08:01 6070276                            \/sbin\/init\n01c21000-01c42000 rw-p 00000000 00:00 0                                  [heap]\n7f641ff63000-7f641ff100000 r-xp 00000000 08:01 14532647                   \/lib\/x86_64-linux-gnu\/libdl-2.13.so\n7f641ff100000-7f64201100000 ---p 00002000 08:01 14532647                   \/lib\/x86_64-linux-gnu\/libdl-2.13.so\n7f64201100000-7f6420166000 r--p 00002000 08:01 14532647                   \/lib\/x86_64-linux-gnu\/libdl-2.13.so\n7f6420166000-7f6420167000 rw-p 00003000 08:01 14532647                   \/lib\/x86_64-linux-gnu\/libdl-2.13.so\n7f6420167000-7f64202e4000 r-xp 00000000 08:01 14532633                   \/lib\/x86_64-linux-gnu\/libc-2.13.so\n7f64202e4000-7f64204e4000 ---p 0017d000 08:01 14532633                   \/lib\/x86_64-linux-gnu\/libc-2.13.so\n7f64204e4000-7f64204e8000 r--p 0017d000 08:01 14532633                   \/lib\/x86_64-linux-gnu\/libc-2.13.so\n7f64204e8000-7f64204e9000 rw-p 00181000 08:01 14532633                   \/lib\/x86_64-linux-gnu\/libc-2.13.so\n7f64204e9000-7f64204ee000 rw-p 00000000 00:00 0\n7f64204ee000-7f642050b000 r-xp 00000000 08:01 95764100                    \/lib\/x86_64-linux-gnu\/libselinux.so.1\n7f642050b000-7f642070b000 ---p 0001d000 08:01 95764100                    \/lib\/x86_64-linux-gnu\/libselinux.so.1\n7f642070b000-7f642070c000 r--p 0001d000 08:01 95764100                    \/lib\/x86_64-linux-gnu\/libselinux.so.1\n7f642070c000-7f642070d000 rw-p 0001e000 08:01 95764100                    \/lib\/x86_64-linux-gnu\/libselinux.so.1\n7f642070d000-7f642070e000 rw-p 00000000 00:00 0\n7f642070e000-7f642074c000 r-xp 00000000 08:01 14401899                   \/lib\/x86_64-linux-gnu\/libsepol.so.1\n7f642074c000-7f642094c000 ---p 0003e000 08:01 14401899                   \/lib\/x86_64-linux-gnu\/libsepol.so.1\n7f642094c000-7f642094d000 rw-p 0003e000 08:01 14401899                   \/lib\/x86_64-linux-gnu\/libsepol.so.1\n7f642094d000-7f642096c000 r-xp 00000000 08:01 14532660                   \/lib\/x86_64-linux-gnu\/ld-2.13.so\n7f6420b44000-7f6420b48000 rw-p 00000000 00:00 0\n7f6420b6a000-7f6420b6c000 rw-p 00000000 00:00 0\n7f6420b6c000-7f6420b6d000 r--p 0001f000 08:01 14532660                   \/lib\/x86_64-linux-gnu\/ld-2.13.so\n7f6420b6d000-7f6420b6e000 rw-p 00020000 08:01 14532660                   \/lib\/x86_64-linux-gnu\/ld-2.13.so\n7f6420b6e000-7f6420b6f000 rw-p 00000000 00:00 0\n7fffa543c000-7fffa545d000 rw-p 00000000 00:00 0                          [stack]\n7fffa55ff000-7fffa5600000 r-xp 00000000 00:00 0                          [vdso]\nffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]\n\n<\/pre>\n<p><\/p>\n<h4><u>Parameter Definition<\/u><\/h4>\n<pre>\nThe \/proc\/PID\/maps file containing the currently mapped memory regions and\ntheir access permissions.\n\n\nwhere \"address\" is the address space in the process that it occupies, \"perms\"\nis a set of permissions:\n\n r = read\n w = write\n x = execute\n s = shared\n p = private (copy on write)\n\n\"offset\" is the offset into the mapping, \"dev\" is the device (major:minor), and\n\"inode\" is the inode  on that device.  0 indicates that  no inode is associated\nwith the memory region, as the case would be with BSS (uninitialized data).\nThe \"pathname\" shows the name associated file for this mapping.  If the mapping\nis not associated with a file:\n\n [heap]                   = the heap of the program\n [stack]                  = the stack of the main process\n [vdso]                   = the \"virtual dynamic shared object\",\n                            the kernel system call handler\n\n or if empty, the mapping is anonymous.\n\n\n<\/pre>\n<p><\/p>\n<h4><u>Parameter Code Related Internals<\/u><\/h4>\n<pre>\nstruct proc_dir_entry *my_proc_file = NULL;\n \/* Create a proc file *\/\nmy_proc_file = create_proc_entry(\"rt-embedded\", S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH, NULL);\n\nif (my_proc_file)\n{\n  \/* Setup the Read and Write functions *\/\n  my_proc_file-&gt;read_proc  = my_proc_read;\n  my_proc_file-&gt;write_proc = my_proc_write;\n}\n\n<\/pre>\n<p><\/p>\n<h4><u>Related From a Paper<\/u><\/h4>\n<pre>\nThe full address space of a process is rarely used, only sparse regions are. Each\nregion is represented by a vm_area_struct which never overlap and represent a set\nof addresses with the same protection and purpose. Examples of a region include\na read-only shared library loaded into the address space or the process heap. A\nfull list of mapped regions a process has may be viewed via the proc interface at\n\/proc\/PID\/maps where PID is the process ID of the process that is to be examined.\nThe region may have a number of di?erent structures associated with it as illus-\ntrated in Figure 5.2. At the top, there is the vm_area_struct which on its own is\nenough to represent anonymous memory.\nIf a ?le is memory mapped, the struct ?le is available through the vm_file ?eld\nwhich has a pointer to the struct inode. The inode is used to get the struct\naddress_space which has all the private information about the ?le including a set\nof pointers to ?lesystem functions which perform the ?lesystem speci?c operations\nsuch as reading and writing pages to disk\n\nsource :\nUnderstanding The\nLinux Virtual Memory Manager\nMel Gorman\n15th February 2004\n\nhttp:\/\/www.cs.miami.edu\/~burt\/learning\/Csc521.071\/notes\/understand.pdf\n<\/pre>\n<p>\n<u>Theory Drop<\/u><\/p>\n<pre>\nIn  computer  science, a  heap  is  a  specialized tree-based  data\nstructure that satisfies the heap property\nHeaps\n\nA binary tree has the heap property iff\nit is empty or\nthe key in the root is larger than that in either child and both subtrees have the heap property.\n\nsource:http:\/\/en.wikipedia.org\/wiki\/Heap_(data_structure)\nhttp:\/\/www.cs.auckland.ac.nz\/~jmor159\/PLDS210\/heaps.html\n<\/pre>\n<p><u>Fix Required<\/u><\/p>\n<pre style=\"color:blue;\">\nRelated from Paper section has junk charecters\nwhich should be replaced by proper letters.\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>UNIX Parameter $sudo cat \/proc\/1\/maps [sudo] password for jeffrin: 00400000-00409000 r-xp 00000000 08:01 6070276 \/sbin\/init 00608000-00609000 r&#8211;p 00008000 08:01 6070276 \/sbin\/init 00609000-0060a000 rw-p 00009000 08:01 6070276 \/sbin\/init 01c21000-01c42000 rw-p 00000000 00:00 0 [heap] 7f641ff63000-7f641ff100000 r-xp 00000000 08:01 14532647 \/lib\/x86_64-linux-gnu\/libdl-2.13.so 7f641ff100000-7f64201100000 &#8212;p 00002000 08:01 14532647 \/lib\/x86_64-linux-gnu\/libdl-2.13.so 7f64201100000-7f6420166000 r&#8211;p 00002000 08:01 14532647 \/lib\/x86_64-linux-gnu\/libdl-2.13.so 7f6420166000-7f6420167000 rw-p 00003000 08:01 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2012\/03\/29\/maps-memory-maps-to-executables-and-library-files-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;maps   Memory maps to executables and library files&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/7006"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=7006"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/7006\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=7006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=7006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=7006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}