Is the vdso shared library (linux-vdso.so) the library that contains the kernel object code (system calls)

dynamic-linkingkernellibrariesshared librarysystem-calls

I noticed that all my programs compiled to gcc are linked to vdso library. Is this the library that contain the system calls to the kernel, like mmap() and fork() and other system calls?

I know that system calls are not functions of the GNU C standard library so their object code must be in some library that is linked with the application at the compilation?

So is the vdso that library?

Best Answer

System calls are implemented in the kernel, as mentioned in the answer to your followup question. vDSO, the virtual dynamic shared object, is a small virtual library, also implemented by the kernel, which the kernel maps into all processes. Like syscalls it is wrapped by the C library.

The main difference between syscalls and the vDSO is one of privilege. System calls are executed in kernel space, and switching between user space and kernel space is expensive. As an optimisation, some system calls which don’t actually need to run in kernel space are provided in the vDSO, which runs in user space. An example is gettimeofday which tends to be called quite often and can be implemented by the kernel without switching to kernel space.

The vdso manpage has more details. For a detailed discussion of system calls on Linux in general, including vDSO, see Anatomy of a system call part 1 and part 2.

Related Question