Commit 0f21818
solib_bootstrap: fix x86-64 ld.so jump clobbering entry address
The x86-64 inline asm restoring the kernel stack and jumping to ld.so:
"mov %[sp], %%rsp\n"
"xor %%edx, %%edx\n" // required: rdx = 0 for ld.so startup ABI
"jmp *%[entry]\n"
GCC at -O0 allocated %[entry] (ldso_entry) to rdx, causing the xor to
zero the jump target before the jmpq executed → SIGSEGV at address 0x0
on every x86-64 ExecSolib launch.
Fix: use "m" constraint for ldso_entry so GCC keeps it in a stack slot
(memory) instead of a register, making the xor harmless. The jmpq
now emits "jmpq *-N(%rbp)" — an indirect memory jump — which reads
ldso_entry from the old frame after rsp has been restored.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent e3c4da7 commit 0f21818
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
340 | 344 | | |
341 | 345 | | |
342 | | - | |
| 346 | + | |
343 | 347 | | |
344 | | - | |
345 | | - | |
346 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
347 | 351 | | |
348 | 352 | | |
349 | 353 | | |
| |||
0 commit comments