197f26cabSMauro Carvalho ChehabWhat: vDSO 297f26cabSMauro Carvalho ChehabDate: July 2011 397f26cabSMauro Carvalho ChehabKernelVersion: 3.0 497f26cabSMauro Carvalho ChehabContact: Andy Lutomirski <luto@kernel.org> 597f26cabSMauro Carvalho ChehabDescription: 697f26cabSMauro Carvalho Chehab 798eedc3aSAndy LutomirskiOn some architectures, when the kernel loads any userspace program it 898eedc3aSAndy Lutomirskimaps an ELF DSO into that program's address space. This DSO is called 998eedc3aSAndy Lutomirskithe vDSO and it often contains useful and highly-optimized alternatives 1098eedc3aSAndy Lutomirskito real syscalls. 1198eedc3aSAndy Lutomirski 1298eedc3aSAndy LutomirskiThese functions are called just like ordinary C function according to 1398eedc3aSAndy Lutomirskiyour platform's ABI. Call them from a sensible context. (For example, 1498eedc3aSAndy Lutomirskiif you set CS on x86 to something strange, the vDSO functions are 1598eedc3aSAndy Lutomirskiwithin their rights to crash.) In addition, if you pass a bad 1698eedc3aSAndy Lutomirskipointer to a vDSO function, you might get SIGSEGV instead of -EFAULT. 1798eedc3aSAndy Lutomirski 1898eedc3aSAndy LutomirskiTo find the DSO, parse the auxiliary vector passed to the program's 1998eedc3aSAndy Lutomirskientry point. The AT_SYSINFO_EHDR entry will point to the vDSO. 2098eedc3aSAndy Lutomirski 2198eedc3aSAndy LutomirskiThe vDSO uses symbol versioning; whenever you request a symbol from the 2298eedc3aSAndy LutomirskivDSO, specify the version you are expecting. 2398eedc3aSAndy Lutomirski 2498eedc3aSAndy LutomirskiPrograms that dynamically link to glibc will use the vDSO automatically. 25904d94f0SBaruch SiachOtherwise, you can use the reference parser in 26904d94f0SBaruch Siachtools/testing/selftests/vDSO/parse_vdso.c. 2798eedc3aSAndy Lutomirski 2898eedc3aSAndy LutomirskiUnless otherwise noted, the set of symbols with any given version and the 2998eedc3aSAndy LutomirskiABI of those symbols is considered stable. It may vary across architectures, 3098eedc3aSAndy Lutomirskithough. 3198eedc3aSAndy Lutomirski 3298913408SMauro Carvalho ChehabNote: 3398913408SMauro Carvalho Chehab As of this writing, this ABI documentation as been confirmed for x86_64. 3498eedc3aSAndy Lutomirski The maintainers of the other vDSO-using architectures should confirm 3598913408SMauro Carvalho Chehab that it is correct for their architecture. 36