vDSO (virtual dynamic shared object) is a mechanism employed by the Linux kernel for exporting a carefully selected set of kernel space routines to user space applications so that applications can call these routines in-process, without incurring the performance penalty of a context switch that is inherent when calling these same routines in kernel space by means of the system call interface.[1]
History
editvDSO has been developed to replace the vsyscall interface while offering similar features and overcoming its limitations: small amount of allocated memory allowing only 4 system calls located at the same memory location in each process, compromising security. This security issue has been fixed by emulating a virtual system call, so applications still using the vsyscall interface are incurring a small performance hit.[2]
Implementation details
editvDSO uses existing standard mechanisms for linking and loading with userspace applications, via the Executable and Linkable Format (ELF) format.[3][4]
In principle, vDSO is a simple ELF shared object allocated in every user space application's address space which exposes some kernel functionalities. vDSO is dynamically allocated (vsyscall was statically allocated) offering support for address space layout randomization, thus increasing defense against certain types of attacks. The use of dynamic allocation and the ELF format also allows for more than 4 virtual calls. vDSO links seamlessly into user-space application via the dynamic linker and glibc automatically uses vDSO functions if the currently running kernel supports them. Otherwise, a traditional system call is made.[2]
Advantages
editIt helps to reduce the calling overhead on simple kernel routines, and also can work as a way to select the best system call method on some architectures.
An advantage over other methods is that such exported routines can provide proper DWARF (Debug With Attributed Record Format) debugging information.
Implementation generally implies hooks in the dynamic linker to find the vDSOs.
See also
editReferences
edit- ^ "vDSO - overview of the virtual ELF dynamic shared object". Canonical. Retrieved 10 December 2015.
- ^ a b "Community answer to question "What are vDSO and vsyscall?"". Retrieved 19 November 2016.
- ^ "Creating a vDSO: the Colonel's Other Chicken". Linuxjournal.com. Retrieved 16 February 2015.
- ^ "On vsyscalls and the vDSO". Lwn.net. Retrieved 16 February 2015.