18c2ecf20Sopenharmony_ciWhat:		vDSO
28c2ecf20Sopenharmony_ciDate:		July 2011
38c2ecf20Sopenharmony_ciKernelVersion:	3.0
48c2ecf20Sopenharmony_ciContact:	Andy Lutomirski <luto@kernel.org>
58c2ecf20Sopenharmony_ciDescription:
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciOn some architectures, when the kernel loads any userspace program it
88c2ecf20Sopenharmony_cimaps an ELF DSO into that program's address space.  This DSO is called
98c2ecf20Sopenharmony_cithe vDSO and it often contains useful and highly-optimized alternatives
108c2ecf20Sopenharmony_cito real syscalls.
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciThese functions are called just like ordinary C function according to
138c2ecf20Sopenharmony_ciyour platform's ABI.  Call them from a sensible context.  (For example,
148c2ecf20Sopenharmony_ciif you set CS on x86 to something strange, the vDSO functions are
158c2ecf20Sopenharmony_ciwithin their rights to crash.)  In addition, if you pass a bad
168c2ecf20Sopenharmony_cipointer to a vDSO function, you might get SIGSEGV instead of -EFAULT.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciTo find the DSO, parse the auxiliary vector passed to the program's
198c2ecf20Sopenharmony_cientry point.  The AT_SYSINFO_EHDR entry will point to the vDSO.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciThe vDSO uses symbol versioning; whenever you request a symbol from the
228c2ecf20Sopenharmony_civDSO, specify the version you are expecting.
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciPrograms that dynamically link to glibc will use the vDSO automatically.
258c2ecf20Sopenharmony_ciOtherwise, you can use the reference parser in
268c2ecf20Sopenharmony_citools/testing/selftests/vDSO/parse_vdso.c.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciUnless otherwise noted, the set of symbols with any given version and the
298c2ecf20Sopenharmony_ciABI of those symbols is considered stable.  It may vary across architectures,
308c2ecf20Sopenharmony_cithough.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciNote:
338c2ecf20Sopenharmony_ci As of this writing, this ABI documentation as been confirmed for x86_64.
348c2ecf20Sopenharmony_ci The maintainers of the other vDSO-using architectures should confirm
358c2ecf20Sopenharmony_ci that it is correct for their architecture.
36