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 12*6eda706aSChristophe LeroyThese functions are called according to your platform's ABI. On many 13*6eda706aSChristophe Leroyplatforms they are called just like ordinary C function. On other platforms 14*6eda706aSChristophe Leroy(ex: powerpc) they are called with the same convention as system calls which 15*6eda706aSChristophe Leroyis different from ordinary C functions. Call them from a sensible context. 16*6eda706aSChristophe Leroy(For example, if you set CS on x86 to something strange, the vDSO functions are 1798eedc3aSAndy Lutomirskiwithin their rights to crash.) In addition, if you pass a bad 1898eedc3aSAndy Lutomirskipointer to a vDSO function, you might get SIGSEGV instead of -EFAULT. 1998eedc3aSAndy Lutomirski 2098eedc3aSAndy LutomirskiTo find the DSO, parse the auxiliary vector passed to the program's 2198eedc3aSAndy Lutomirskientry point. The AT_SYSINFO_EHDR entry will point to the vDSO. 2298eedc3aSAndy Lutomirski 2398eedc3aSAndy LutomirskiThe vDSO uses symbol versioning; whenever you request a symbol from the 2498eedc3aSAndy LutomirskivDSO, specify the version you are expecting. 2598eedc3aSAndy Lutomirski 2698eedc3aSAndy LutomirskiPrograms that dynamically link to glibc will use the vDSO automatically. 27904d94f0SBaruch SiachOtherwise, you can use the reference parser in 28904d94f0SBaruch Siachtools/testing/selftests/vDSO/parse_vdso.c. 2998eedc3aSAndy Lutomirski 3098eedc3aSAndy LutomirskiUnless otherwise noted, the set of symbols with any given version and the 3198eedc3aSAndy LutomirskiABI of those symbols is considered stable. It may vary across architectures, 3298eedc3aSAndy Lutomirskithough. 3398eedc3aSAndy Lutomirski 3498913408SMauro Carvalho ChehabNote: 3598913408SMauro Carvalho Chehab As of this writing, this ABI documentation as been confirmed for x86_64. 3698eedc3aSAndy Lutomirski The maintainers of the other vDSO-using architectures should confirm 3798913408SMauro Carvalho Chehab that it is correct for their architecture. 38