162306a36Sopenharmony_ciWhat: vDSO 262306a36Sopenharmony_ciDate: July 2011 362306a36Sopenharmony_ciKernelVersion: 3.0 462306a36Sopenharmony_ciContact: Andy Lutomirski <luto@kernel.org> 562306a36Sopenharmony_ciDescription: 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciOn some architectures, when the kernel loads any userspace program it 862306a36Sopenharmony_cimaps an ELF DSO into that program's address space. This DSO is called 962306a36Sopenharmony_cithe vDSO and it often contains useful and highly-optimized alternatives 1062306a36Sopenharmony_cito real syscalls. 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ciThese functions are called just like ordinary C function according to 1362306a36Sopenharmony_ciyour platform's ABI. Call them from a sensible context. (For example, 1462306a36Sopenharmony_ciif you set CS on x86 to something strange, the vDSO functions are 1562306a36Sopenharmony_ciwithin their rights to crash.) In addition, if you pass a bad 1662306a36Sopenharmony_cipointer to a vDSO function, you might get SIGSEGV instead of -EFAULT. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciTo find the DSO, parse the auxiliary vector passed to the program's 1962306a36Sopenharmony_cientry point. The AT_SYSINFO_EHDR entry will point to the vDSO. 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ciThe vDSO uses symbol versioning; whenever you request a symbol from the 2262306a36Sopenharmony_civDSO, specify the version you are expecting. 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ciPrograms that dynamically link to glibc will use the vDSO automatically. 2562306a36Sopenharmony_ciOtherwise, you can use the reference parser in 2662306a36Sopenharmony_citools/testing/selftests/vDSO/parse_vdso.c. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ciUnless otherwise noted, the set of symbols with any given version and the 2962306a36Sopenharmony_ciABI of those symbols is considered stable. It may vary across architectures, 3062306a36Sopenharmony_cithough. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciNote: 3362306a36Sopenharmony_ci As of this writing, this ABI documentation as been confirmed for x86_64. 3462306a36Sopenharmony_ci The maintainers of the other vDSO-using architectures should confirm 3562306a36Sopenharmony_ci that it is correct for their architecture. 36