Reasons Behind the vDSO
The vDSO manual page has this to say about the reason for creating this special library:
Why does the vDSO exist at all? There are some system calls the
kernel provides that user-space code ends up using frequently, to
the point that such calls can dominate overall performance. This
is due both to the frequency of the call as well as the context-
switch overhead that results from exiting user space and entering
the kernel.
Further reading will tell you of the various strategies used to make it possible to share data between the kernel and user space. Especially:
This information is also not secret—any application
in any privilege mode (root or any unprivileged user) will get
the same answer.
Note: Emphasis mine.
That tells us that the data offered through that vDSO interface has to be public, something that any process running on the system would anyway have access to. This is obviously very important.
So to recap we have two reasons/constraints for adding functions to the vDSO:
- The functions must be providing information which is not secret
- The functions must be used so much that it is really worth moving to the vDSO
Available Functions
If you look further in the vDSO manual page, you will notice lists of functions supported by various implementations (See the *ARCHITECTURE-SPECIFIC NOTES section). This gives us another piece of information: the Linux version when such and such was implemented/accessible. The very first available implementation was in Linux 2.5 (late 2001, note also that was a development version, so the first user available version was 2.6.1 in 2003).
We find the following functions in the vDSO:
sigreturn
rt_sigreturn
sigtramp
sigtramp32
sigtramp_rt32
sigtramp_rt64
syscall_via_break
syscall_via_epc
vsyscall
get_syscall_map
lws_entry
linux_gateway_entry
gettimeofday
clock_gettime
clock_gettime64
clock_getres
time
getcpu
get_tbfreq
sync_dicache
sync_dicache_p5
flush_icache
getpid
getppid
set_tid_address
set_thread_pointer
datapage_offset
So overall we see calls for:
- Signal
- System/Kernel
- Time
- CPU/Cache
- Processes
For x86 processors, it is mostly limited to Time and CPU. In i386, there are signal related functions too.