[pso] Slideul 39 din cursul 2

Octavian Voicu octavian.voicu at gmail.com
Sun Mar 7 23:36:30 EET 2010


Am scris un program care citeste /proc/self/maps si apoi
extrage linux-gate.so din /proc/self/mem (vezi fisierul atasat, readvdso.c).

Functioneaza si pentru
randomize_va_space<http://lxr.linux.no/linux+v2.6.33/Documentation/sysctl/kernel.txt#L377>!=
0 (pentru ca citeste map-urile din procesul curent). Din shell
scripting
acest lucru nu este posibil deoarece nu putem sti adresa la care o sa fie
mapat vdso-ul procesului dd inainte de a-l rula, iar /proc/PID/mem poate fi
citit numai daca PID corespunde cu id-ul procesului curent.

$ uname -a
Linux cake 2.6.31-20-generic #57-Ubuntu SMP Mon Feb 8 09:02:26 UTC 2010
x86_64 GNU/Linux
$ cat /proc/sys/kernel/randomize_va_space
2
$ make readvdso
cc     readvdso.c   -o readvdso
$ ./readvdso linux-gate.so
7fff697ff000-7fff69800000 [vdso]
$ file linux-gate.so
linux-gate.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, stripped

$ objdump -x linux-gate.so

linux-gate.so:     file format elf64-x86-64
...
Version definitions:
1 0x01 0x0deebfa1 linux-vdso.so.1
2 0x00 0x03ae75f6 LINUX_2.6
...


Octavian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/pso/attachments/20100307/4647a7a1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: readvdso.c
Type: text/x-csrc
Size: 1918 bytes
Desc: not available
URL: <http://cursuri.cs.pub.ro/pipermail/pso/attachments/20100307/4647a7a1/attachment.c>


More information about the pso mailing list