xref: /openbmc/linux/Documentation/ABI/stable/vdso (revision 904d94f0)
198eedc3aSAndy LutomirskiOn some architectures, when the kernel loads any userspace program it
298eedc3aSAndy Lutomirskimaps an ELF DSO into that program's address space.  This DSO is called
398eedc3aSAndy Lutomirskithe vDSO and it often contains useful and highly-optimized alternatives
498eedc3aSAndy Lutomirskito real syscalls.
598eedc3aSAndy Lutomirski
698eedc3aSAndy LutomirskiThese functions are called just like ordinary C function according to
798eedc3aSAndy Lutomirskiyour platform's ABI.  Call them from a sensible context.  (For example,
898eedc3aSAndy Lutomirskiif you set CS on x86 to something strange, the vDSO functions are
998eedc3aSAndy Lutomirskiwithin their rights to crash.)  In addition, if you pass a bad
1098eedc3aSAndy Lutomirskipointer to a vDSO function, you might get SIGSEGV instead of -EFAULT.
1198eedc3aSAndy Lutomirski
1298eedc3aSAndy LutomirskiTo find the DSO, parse the auxiliary vector passed to the program's
1398eedc3aSAndy Lutomirskientry point.  The AT_SYSINFO_EHDR entry will point to the vDSO.
1498eedc3aSAndy Lutomirski
1598eedc3aSAndy LutomirskiThe vDSO uses symbol versioning; whenever you request a symbol from the
1698eedc3aSAndy LutomirskivDSO, specify the version you are expecting.
1798eedc3aSAndy Lutomirski
1898eedc3aSAndy LutomirskiPrograms that dynamically link to glibc will use the vDSO automatically.
19*904d94f0SBaruch SiachOtherwise, you can use the reference parser in
20*904d94f0SBaruch Siachtools/testing/selftests/vDSO/parse_vdso.c.
2198eedc3aSAndy Lutomirski
2298eedc3aSAndy LutomirskiUnless otherwise noted, the set of symbols with any given version and the
2398eedc3aSAndy LutomirskiABI of those symbols is considered stable.  It may vary across architectures,
2498eedc3aSAndy Lutomirskithough.
2598eedc3aSAndy Lutomirski
2698eedc3aSAndy Lutomirski(As of this writing, this ABI documentation as been confirmed for x86_64.
2798eedc3aSAndy Lutomirski The maintainers of the other vDSO-using architectures should confirm
2898eedc3aSAndy Lutomirski that it is correct for their architecture.)
29