1

I have a program which parses the /proc/id/maps file created for another program with given PID. For a small test case, I created a C program which just prints the process' PID and loops forever. I compiled it with the gcc compiler without any special flags.

00400000-00404000 r-xp 00000000 09:7c 60209293365
00603000-00604000 r--p 00003000 09:7c 60209293365
00604000-00605000 rw-p 00004000 09:7c 60209293365

This is all well. As far as I understand, there are several segments in the ELF standard which can be seen here.

On a different Ubuntu system, I see a different result:

00400000-00401000 r--p 00000000 103:03 1582924
00401000-00490000 r-xp 00001000 103:03 1582924
00490000-004b4000 r--p 00090000 103:03 1582924
004b5000-004bb000 rw-p 000b4000 103:03 1582924

Here, before the executable part denoted with r-xp, there is another entry. I do not yet understand where this comes from. Can you help me out here?

Some more infos:

  • Unfortunately, I was not able to use the exact same compiler versions of gcc (8.2.0 on CentOS and 8.3.0 on Ubuntu). I rule out this error source but I'm not completely sure.
  • I did the same test also on a Ubuntu Virtual Box on Windows, which confirmed the observation on the CentOS system.
talonmies
  • 70,661
  • 34
  • 192
  • 269

0 Answers0