KZT, fix: Align x86-64 JUMP_SLOT relocation with glibc - #478
Open
baibaidashixiong wants to merge 1 commit into
Open
KZT, fix: Align x86-64 JUMP_SLOT relocation with glibc#478baibaidashixiong wants to merge 1 commit into
baibaidashixiong wants to merge 1 commit into
Conversation
glibc ignores the RELA addend for R_X86_64_JUMP_SLOT and writes the resolved symbol value directly to the relocation slot. previously added r_addend during immediate binding. A nonzero addend could therefore shift a KZT bridge address to an invalid entry point, as observed for realloc in guest libc. Write the resolved symbol address without the addend, matching glibc and LATX's existing lazy resolver. Signed-off-by: zqz <OrzZzznn@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 变更说明
Align x86-64
R_X86_64_JUMP_SLOThandling with glibc by writing theresolved symbol address without adding the RELA addend.
glibc explicitly ignores the addend for this relocation type:
elf_machine_plt_value()returns the symbol value unchanged, andelf_machine_fixup_plt()writes that value to the relocation slot.LATX previously added
r_addendwhen applying an immediate JUMP_SLOTrelocation. With a nonzero addend, this could shift a resolved KZT bridge
address to an invalid entry point, as observed with a
reallocrelocation in guest libc when running Steam webhelper.
This change also makes immediate binding consistent with LATX's existing
lazy resolver. It applies to the shared x86-64 KZT relocation path and
does not introduce Steam-specific handling.
Reference:
https://github.com/bminor/glibc/blob/master/sysdeps/x86_64/dl-machine.h
Validation / 验证
Validation recorded for this commit:
the
reallocJUMP_SLOT relocation:Checklist / 检查项
CONTRIBUTING.md. / 我已阅读CONTRIBUTING.md。git commit -s). /每个提交都包含 DCO 签署(
git commit -s)。are not applicable. /
我已提供相关构建或测试结果,或说明了不适用的原因。