Looks like they have added a new section GNU_RELRO in the later versions. The one you are referring is read-only section. It would be nice if you share the section header table. Plz see inline
Regards, Prabhunath G Linux Trainer Bangalore On Thu, Mar 7, 2013 at 3:31 PM, Jacky <[email protected]> wrote: > Dear all, > > This is the Program Header for "cat" info: > > ================================ > readelf -l /bin/cat > ... > Program Headers: > Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align > PHDR 0x000034 0x08048034 0x08048034 0x00120 0x00120 R E 0x4 > INTERP 0x000154 0x08048154 0x08048154 0x00013 0x00013 R 0x1 > [Requesting program interpreter: /lib/ld-linux.so.2] > LOAD 0x000000 0x08048000 0x08048000 0x0a00c 0x0a00c R E 0x1000 > LOAD 0x00af04 0x08053f04 0x08053f04 0x00258 0x00820 RW 0x1000 > DYNAMIC 0x00af10 0x08053f10 0x08053f10 0x000e8 0x000e8 RW 0x4 > NOTE 0x000168 0x08048168 0x08048168 0x00044 0x00044 R 0x4 > GNU_EH_FRAME 0x009008 0x08051008 0x08051008 0x002d4 0x002d4 R 0x4 > GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4 > GNU_RELRO 0x00af04 0x08053f04 0x08053f04 0x000fc 0x000fc R 0x1 > ============================== > > So there are just 2 PT_LOAD segments. But why kernel maps 3 memory regions > ? The following is the maps output: > > Though the second PT_LOAD starts at the file offset 0xaf04, The first fc bytes belong to GNU_RELRO segment (The last entry in the Program Header). If you add af04 +fc you get afff. Looks like they have placed this section advertently in such a way that the actual DATA segment will start at the next virtual address page boundary 0x08054000. Thus the GNU_RELRO section with read-only permissions is placed in the separate virtual address region. This is the result of the maps file you see below. > ============================ > cat /proc/self/maps > > 08048000-08053000 r-xp 00000000 08:01 261656 /bin/cat > 08053000-08054000 r--p 0000a000 08:01 261656 /bin/cat > 08054000-08055000 rw-p 0000b000 08:01 261656 /bin/cat > 09b58000-09b79000 rw-p 00000000 00:00 0 [heap] > b75bd000-b75be000 rw-p 00000000 00:00 0 > b75be000-b7761000 r-xp 00000000 08:01 523958 /lib/i386-linux-gnu/ > libc-2.15.so > ... > ================== > > The above output, there are 3 memory regions for "/bin/cat", and what is > the following segment: > > 08053000-08054000 r--p 0000a000 08:01 261656 /bin/cat > > According the 'cat' program header, there is no "r" segment. > > > Regards, > Jacky > > > > > > > > > > > > > _______________________________________________ > Kernelnewbies mailing list > [email protected] > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > >
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
