Commit b2ae41d
committed
Emit NT_GNU_ABI_TAG PT_NOTE so dynamic glibc binds
The synthetic vDSO at AT_SYSINFO_EHDR already carries DT_HASH,
LINUX_2.6.39 symbol versioning, and five __kernel_* trampolines, but
glibc 2.41's dynamic-linker vDSO probe rejected the page for lack of an
NT_GNU_ABI_TAG note: every dynamically-linked guest fell back to SVC
for clock_gettime, gettimeofday, and clock_getres. PR #34 measured
1006 ns/op against an 18 ns/op OrbStack reference, a 56x gap the
TODO Tier D P1 entry tracked as the highest-leverage single fix.
This adds the note. To avoid moving VVAR (0x0B0), TEXT_OFF_SIGRET
(0x0E0, exported in vdso.h for signal.c), or any trampoline / section
offset, the program-header table relocates from 0x040 to 0x6B0 (after
the section-header area). The reclaimed 0x040 window now holds the
32-byte NT_GNU_ABI_TAG:
namesz : 4 ("GNU\0")
descsz : 16
type : NT_GNU_ABI_TAG (1)
name : "GNU\0"
desc : { ELF_NOTE_OS_LINUX (0), 2, 6, 39 }
The descriptor's minimum kernel ABI (2.6.39) matches the LINUX_2.6.39
symbol version already exposed through DT_VERDEF, so a glibc that
honors the version also honors the note. PT_LOAD continues to cover
the whole page so the relocated PHDR table and the note both stay
mapped at runtime.
Validation, dynamically-linked glibc 2.41 binary built from the
cross-toolchain sysroot at /opt/toolchain/aarch64-linux-gnu (same
toolchain PR #34 used for the baseline):
libc clock_gettime : 6.97 ns/op (was 1006 ns/op pre-fix)
direct vDSO call : 6.24 ns/op (dlsym function-pointer)
raw SVC syscall : 2047.01 ns/op
libc/vDSO ratio = 1.12x -- libc IS using the vDSO
The 0.7 ns libc-vs-direct gap is glibc's dl_sysinfo_dso dispatch, not
an SVC fallback. libc clock_gettime now beats the OrbStack reference
(18 ns/op) by ~2.6x. gettimeofday and clock_getres land on the
trampolines through the same probe path:
libc gettimeofday : 7.5 ns/op (vDSO REALTIME anchor reuse)
libc clock_getres : 4.9 ns/op (constant-resolution path)
readelf parses the page cleanly: e_phnum=3, e_phoff=0x6B0, three
PHDRs (PT_LOAD covering the whole page, PT_DYNAMIC at 0x420 size
0x90, PT_NOTE at 0x40 size 0x20), and `readelf -n` decodes the note as
"GNU NT_GNU_ABI_TAG OS: Linux, ABI: 2.6.39". No region overlaps;
total page usage 0x758 / 0x1000.
Static vDSO bench unchanged at 6 ns/op for the time fast paths; the
PHDR relocation only shifts where the dynamic linker looks for the
table and does not touch any code the trampolines execute. test-signal
explicit run passes, confirming the unchanged TEXT_OFF_SIGRET=0xE0
trampoline still drives the libc __restore_rt path.1 parent 8ee57eb commit b2ae41d
3 files changed
Lines changed: 140 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
122 | 137 | | |
123 | 138 | | |
124 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
125 | 148 | | |
126 | | - | |
127 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
128 | 154 | | |
129 | 155 | | |
130 | 156 | | |
| |||
240 | 266 | | |
241 | 267 | | |
242 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
243 | 279 | | |
244 | 280 | | |
245 | 281 | | |
| |||
248 | 284 | | |
249 | 285 | | |
250 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
251 | 322 | | |
252 | 323 | | |
253 | 324 | | |
| |||
899 | 970 | | |
900 | 971 | | |
901 | 972 | | |
902 | | - | |
| 973 | + | |
903 | 974 | | |
904 | 975 | | |
905 | 976 | | |
906 | 977 | | |
907 | 978 | | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
908 | 998 | | |
909 | 999 | | |
910 | 1000 | | |
| |||
928 | 1018 | | |
929 | 1019 | | |
930 | 1020 | | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
931 | 1032 | | |
932 | 1033 | | |
933 | 1034 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
172 | 206 | | |
173 | 207 | | |
174 | 208 | | |
| |||
0 commit comments