← Documents Documentation/ABI/stable/vdso GitHub 원문 ↗

Linux 6.18.37 · ABI / stable

vDSO stable ABI

Kernel이 userspace program에 매핑하는 vDSO ELF object의 호출 규약, AT_SYSINFO_EHDR 탐색, versioned symbol lookup과 architecture별 안정성 범위를 설명합니다.

Source pathDocumentation/ABI/stable/vdso
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

vDSO mapping과 platform ABI 호출

vdso:1-18

일부 architecture는 syscall의 고도로 최적화된 대안을 담은 ELF DSO를 program address space에 매핑하며, 함수는 platform ABI에 맞게 호출해야 합니다.

AT_SYSINFO_EHDR와 symbol versioning

vdso:20-28

Program entry의 auxiliary vector에서 vDSO 주소를 찾고 기대하는 version을 지정해 symbol을 조회합니다.

Symbol ABI 안정성 범위

vdso:30-37

별도 언급이 없으면 특정 version의 symbol 집합과 ABI는 stable하지만 architecture에 따라 달라질 수 있습니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 What: vDSO
2 Date: July 2011
3 KernelVersion: 3.0
4 Contact: Andy Lutomirski <[email protected]>
5 Description:
6
7 On some architectures, when the kernel loads any userspace program it
8 maps an ELF DSO into that program's address space. This DSO is called
9 the vDSO and it often contains useful and highly-optimized alternatives
10 to real syscalls.
11
12 These functions are called according to your platform's ABI. On many
13 platforms they are called just like ordinary C function. On other platforms
14 (ex: powerpc) they are called with the same convention as system calls which
15 is different from ordinary C functions. Call them from a sensible context.
16 (For example, if you set CS on x86 to something strange, the vDSO functions are
17 within their rights to crash.) In addition, if you pass a bad
18 pointer to a vDSO function, you might get SIGSEGV instead of -EFAULT.
19
20 To find the DSO, parse the auxiliary vector passed to the program's
21 entry point. The AT_SYSINFO_EHDR entry will point to the vDSO.
22
23 The vDSO uses symbol versioning; whenever you request a symbol from the
24 vDSO, specify the version you are expecting.
25
26 Programs that dynamically link to glibc will use the vDSO automatically.
27 Otherwise, you can use the reference parser in
28 tools/testing/selftests/vDSO/parse_vdso.c.
29
30 Unless otherwise noted, the set of symbols with any given version and the
31 ABI of those symbols is considered stable. It may vary across architectures,
32 though.
33
34 Note:
35 As of this writing, this ABI documentation as been confirmed for x86_64.
36 The maintainers of the other vDSO-using architectures should confirm
37 that it is correct for their architecture.
38

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Userspace address space에 매핑되는 vDSO

1-10
항목내용
WhatvDSO
Date2011년 7월
KernelVersion3.0
ContactAndy Lutomirski <[email protected]>

일부 architecture에서는 kernel이 userspace program을 load할 때 ELF DSO 하나를 그 program의 address space에 매핑한다. 이 DSO를 vDSO라고 하며, 실제 syscall을 대신할 수 있는 유용하고 고도로 최적화된 구현을 자주 포함한다.

Platform ABI에 따른 호출 규약과 오류 차이

12-18

이 함수들은 platform ABI에 따라 호출한다. 많은 platform에서는 일반 C 함수처럼 호출한다. PowerPC 같은 다른 platform에서는 일반 C 함수와 다른 system call 호출 규약을 사용한다.

따라서 적절한 context에서 호출해야 한다. 예를 들어 x86에서 CS를 비정상적인 값으로 설정했다면 vDSO 함수가 crash하더라도 ABI 위반이 아니다. 또한 vDSO 함수에 잘못된 pointer를 넘기면 `-EFAULT` 대신 `SIGSEGV`를 받을 수 있다.

Auxiliary vector에서 vDSO 찾기

20-28

DSO를 찾으려면 program entry point에 전달된 auxiliary vector를 parse한다. `AT_SYSINFO_EHDR` entry가 vDSO를 가리킨다.

vDSO는 symbol versioning을 사용한다. vDSO에서 symbol을 요청할 때는 기대하는 version을 지정해야 한다.

glibc에 동적으로 link한 program은 vDSO를 자동으로 사용한다. 그렇지 않은 경우 `tools/testing/selftests/vDSO/parse_vdso.c`의 reference parser를 사용할 수 있다.

vDSO 발견과 versioned symbol 호출
Kernel이 program address space에 vDSO ELF DSO 매핑Program entry point에 auxiliary vector 전달AT_SYSINFO_EHDR에서 vDSO ELF header 주소 획득ELF dynamic symbol과 version 정보 parse기대하는 version의 symbol 선택Platform ABI 호출 규약으로 함수 실행

Program이 auxiliary vector를 출발점으로 vDSO ELF image를 찾고 원하는 version의 symbol을 호출하는 순서이다.

Architecture별 symbol ABI 안정성

30-37

별도로 언급하지 않는 한, 주어진 version에 속하는 symbol 집합과 그 symbol의 ABI는 stable한 것으로 간주한다. 다만 그 집합과 ABI는 architecture마다 다를 수 있다.

이 원문이 작성된 시점에는 이 ABI 문서가 x86_64에서 확인되었다. vDSO를 사용하는 다른 architecture의 maintainer는 해당 architecture에서도 내용이 정확한지 확인해야 한다.