обзор виртуального динамического общего объекта ELF (overview of the virtual ELF dynamic shared object)
ARCHITECTURE-SPECIFIC NOTES
The subsections below provide architecture-specific notes on the
vDSO.
Note that the vDSO that is used is based on the ABI of your user-
space code and not the ABI of the kernel. Thus, for example,
when you run an i386 32-bit ELF binary, you'll get the same vDSO
regardless of whether you run it under an i386 32-bit kernel or
under an x86-64 64-bit kernel. Therefore, the name of the user-
space ABI should be used to determine which of the sections below
is relevant.
ARM functions
The table below lists the symbols exported by the vDSO.
symbol version
────────────────────────────────────────────────────────────
__vdso_gettimeofday LINUX_2.6 (exported since Linux 4.1)
__vdso_clock_gettime LINUX_2.6 (exported since Linux 4.1)
Additionally, the ARM port has a code page full of utility
functions. Since it's just a raw page of code, there is no ELF
information for doing symbol lookups or versioning. It does
provide support for different versions though.
For information on this code page, it's best to refer to the
kernel documentation as it's extremely detailed and covers
everything you need to know:
Documentation/arm/kernel_user_helpers.txt.
aarch64 functions
The table below lists the symbols exported by the vDSO.
symbol version
──────────────────────────────────────
__kernel_rt_sigreturn LINUX_2.6.39
__kernel_gettimeofday LINUX_2.6.39
__kernel_clock_gettime LINUX_2.6.39
__kernel_clock_getres LINUX_2.6.39
bfin (Blackfin) functions (port removed in Linux 4.17)
As this CPU lacks a memory management unit (MMU), it doesn't set
up a vDSO in the normal sense. Instead, it maps at boot time a
few raw functions into a fixed location in memory. User-space
applications then call directly into that region. There is no
provision for backward compatibility beyond sniffing raw opcodes,
but as this is an embedded CPU, it can get away with things—some
of the object formats it runs aren't even ELF based (they're
bFLT/FLAT).
For information on this code page, it's best to refer to the
public documentation:
http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:fixed-code
mips functions
The table below lists the symbols exported by the vDSO.
symbol version
──────────────────────────────────────────────────────────────
__kernel_gettimeofday LINUX_2.6 (exported since Linux 4.4)
__kernel_clock_gettime LINUX_2.6 (exported since Linux 4.4)
ia64 (Itanium) functions
The table below lists the symbols exported by the vDSO.
symbol version
───────────────────────────────────────
__kernel_sigtramp LINUX_2.5
__kernel_syscall_via_break LINUX_2.5
__kernel_syscall_via_epc LINUX_2.5
The Itanium port is somewhat tricky. In addition to the vDSO
above, it also has "light-weight system calls" (also known as
"fast syscalls" or "fsys"). You can invoke these via the
__kernel_syscall_via_epc vDSO helper. The system calls listed
here have the same semantics as if you called them directly via
syscall(2), so refer to the relevant documentation for each. The
table below lists the functions available via this mechanism.
function
────────────────
clock_gettime
getcpu
getpid
getppid
gettimeofday
set_tid_address
parisc (hppa) functions
The parisc port has a code page with utility functions called a
gateway page. Rather than use the normal ELF auxiliary vector
approach, it passes the address of the page to the process via
the SR2 register. The permissions on the page are such that
merely executing those addresses automatically executes with
kernel privileges and not in user space. This is done to match
the way HP-UX works.
Since it's just a raw page of code, there is no ELF information
for doing symbol lookups or versioning. Simply call into the
appropriate offset via the branch instruction, for example:
ble <offset>(%sr2, %r0)
offset function
────────────────────────────────────────────
00b0 lws_entry (CAS operations)
00e0 set_thread_pointer (used by glibc)
0100 linux_gateway_entry (syscall)
ppc/32 functions
The table below lists the symbols exported by the vDSO. The
functions marked with a * are available only when the kernel is a
PowerPC64 (64-bit) kernel.
symbol version
────────────────────────────────────────
__kernel_clock_getres LINUX_2.6.15
__kernel_clock_gettime LINUX_2.6.15
__kernel_clock_gettime64 LINUX_5.11
__kernel_datapage_offset LINUX_2.6.15
__kernel_get_syscall_map LINUX_2.6.15
__kernel_get_tbfreq LINUX_2.6.15
__kernel_getcpu * LINUX_2.6.15
__kernel_gettimeofday LINUX_2.6.15
__kernel_sigtramp_rt32 LINUX_2.6.15
__kernel_sigtramp32 LINUX_2.6.15
__kernel_sync_dicache LINUX_2.6.15
__kernel_sync_dicache_p5 LINUX_2.6.15
In kernel versions before Linux 5.6, the CLOCK_REALTIME_COARSE
and CLOCK_MONOTONIC_COARSE
clocks are not supported by the
__kernel_clock_getres and __kernel_clock_gettime interfaces; the
kernel falls back to the real system call.
ppc/64 functions
The table below lists the symbols exported by the vDSO.
symbol version
────────────────────────────────────────
__kernel_clock_getres LINUX_2.6.15
__kernel_clock_gettime LINUX_2.6.15
__kernel_datapage_offset LINUX_2.6.15
__kernel_get_syscall_map LINUX_2.6.15
__kernel_get_tbfreq LINUX_2.6.15
__kernel_getcpu LINUX_2.6.15
__kernel_gettimeofday LINUX_2.6.15
__kernel_sigtramp_rt64 LINUX_2.6.15
__kernel_sync_dicache LINUX_2.6.15
__kernel_sync_dicache_p5 LINUX_2.6.15
In kernel versions before Linux 4.16, the CLOCK_REALTIME_COARSE
and CLOCK_MONOTONIC_COARSE
clocks are not supported by the
__kernel_clock_getres and __kernel_clock_gettime interfaces; the
kernel falls back to the real system call.
riscv functions
The table below lists the symbols exported by the vDSO.
symbol version
────────────────────────────────────
__kernel_rt_sigreturn LINUX_4.15
__kernel_gettimeofday LINUX_4.15
__kernel_clock_gettime LINUX_4.15
__kernel_clock_getres LINUX_4.15
__kernel_getcpu LINUX_4.15
__kernel_flush_icache LINUX_4.15
s390 functions
The table below lists the symbols exported by the vDSO.
symbol version
──────────────────────────────────────
__kernel_clock_getres LINUX_2.6.29
__kernel_clock_gettime LINUX_2.6.29
__kernel_gettimeofday LINUX_2.6.29
s390x functions
The table below lists the symbols exported by the vDSO.
symbol version
──────────────────────────────────────
__kernel_clock_getres LINUX_2.6.29
__kernel_clock_gettime LINUX_2.6.29
__kernel_gettimeofday LINUX_2.6.29
sh (SuperH) functions
The table below lists the symbols exported by the vDSO.
symbol version
──────────────────────────────────
__kernel_rt_sigreturn LINUX_2.6
__kernel_sigreturn LINUX_2.6
__kernel_vsyscall LINUX_2.6
i386 functions
The table below lists the symbols exported by the vDSO.
symbol version
──────────────────────────────────────────────────────────────
__kernel_sigreturn LINUX_2.5
__kernel_rt_sigreturn LINUX_2.5
__kernel_vsyscall LINUX_2.5
__vdso_clock_gettime LINUX_2.6 (exported since Linux 3.15)
__vdso_gettimeofday LINUX_2.6 (exported since Linux 3.15)
__vdso_time LINUX_2.6 (exported since Linux 3.15)
x86-64 functions
The table below lists the symbols exported by the vDSO. All of
these symbols are also available without the "__vdso_" prefix,
but you should ignore those and stick to the names below.
symbol version
─────────────────────────────────
__vdso_clock_gettime LINUX_2.6
__vdso_getcpu LINUX_2.6
__vdso_gettimeofday LINUX_2.6
__vdso_time LINUX_2.6
x86/x32 functions
The table below lists the symbols exported by the vDSO.
symbol version
─────────────────────────────────
__vdso_clock_gettime LINUX_2.6
__vdso_getcpu LINUX_2.6
__vdso_gettimeofday LINUX_2.6
__vdso_time LINUX_2.6
History
The vDSO was originally just a single function—the vsyscall. In
older kernels, you might see that name in a process's memory map
rather than "vdso". Over time, people realized that this
mechanism was a great way to pass more functionality to user
space, so it was reconceived as a vDSO in the current format.