Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#7120: Do not add addend for rela jump slot relocation #7121

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

derekbruening
Copy link
Contributor

Despite "rela" relocations having an explicit addend value and it being set to non-0 in a new Debian glibc, the addend is assumed to not be added to the symbol value when relocating on x86_64 and aarch64 (it does seem to be added on RISCV).
This is not obvious and not well documented; we have to just behave like existing loaders behave from experimentation/examination. (Yet another reason to possibly invert the private loader and let the private copy of ld.so do all the loading and relocating: #5437).

Tested on a machine where nearly every client test in our suite was crashing after a glibc update: now they pass. Unfortunately it's not simple to make automated tests for this: we don't have an existing framework for relocation testing and it would take non-trivial effort to construct that, beyond the scope of this fix.

Fixes #7120

Despite "rela" relocations having an explicit addend value and it
being set to non-0 in a new Debian glibc, the addend is assumed to
*not* be added to the symbol value when relocating on x86_64 and
aarch64 (it does seem to be added on RISCV).
This is not obvious and not well documented; we have to just behave like
existing loaders behave from experimentation/examination.
(Yet another reason to possibly invert the private loader and let
the private copy of ld.so do all the loading and relocating: #5437).

Tested on a machine where nearly every client test in our suite was
crashing after a glibc update: now they pass.  Unfortunately it's not
simple to make automated tests for this: we don't have an existing
framework for relocation testing and it would take non-trivial effort
to construct that, beyond the scope of this fix.

Fixes #7120
core/unix/module_elf.c Show resolved Hide resolved
core/unix/module_elf.c Show resolved Hide resolved
@derekbruening
Copy link
Contributor Author

a64 failures are #3320 again and raw-zlib #5635

@derekbruening derekbruening merged commit fb0542b into master Dec 11, 2024
15 of 17 checks passed
@derekbruening derekbruening deleted the i7120-rela-jmp-slot branch December 11, 2024 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CRASH loading private glibc 2.39-4 from relocation error
2 participants