HomeFreeBSD

linux(4); Almost complete the vDSO.

Description

linux(4); Almost complete the vDSO.

The vDSO (virtual dynamic shared object) is a small shared library that the
kernel maps R/O into the address space of all Linux processes on image
activation. The vDSO is a fully formed ELF image, shared by all processes
with the same ABI, has no process private data.

The primary purpose of the vDSO:

  • non-executable stack, signal trampolines not copied to the stack;
  • signal trampolines unwind, mandatory for the NPTL;
  • to avoid contex-switch overhead frequently used system calls can be implemented in the vDSO: for now gettimeofday, clock_gettime.

The first two have been implemented, so add the implementation of system
calls.

System calls implemenation based on a native timekeeping code with some
limitations:

  • ifunc can't be used, as vDSO r/o mapped to the process VA and rtld can't relocate symbols;
  • reading HPET memory is not implemented for now (TODO).

In case on any error vDSO system calls fallback to the kernel system
calls. For unimplemented vDSO system calls added prototypes which call
corresponding kernel system call.

Tested by: trasz (arm64)
Differential revision: https://reviews.freebsd.org/D30900
MFC after: 2 weeks

Details

Provenance
dchaginAuthored on Jul 20 2021, 7:01 AM
Differential Revision
D30900: linux(4); Almost complete the vDSO.
Parents
rG5fd9cd53d256: linux(4): Modify sv_onexec hook to return an error.
Branches
Unknown
Tags
Unknown