Skip to content

Fix MIPS HI16 relocation overflow - #8466

Merged
plafosse merged 1 commit into
devfrom
codex/fix-mips-hi16-relocation
Sep 9, 2026
Merged

Fix MIPS HI16 relocation overflow#8466
plafosse merged 1 commit into
devfrom
codex/fix-mips-hi16-relocation

Conversation

@plafosse

Copy link
Copy Markdown
Member

Summary

  • mask the computed R_MIPS_HI16 value to the instruction’s 16-bit immediate field
  • prevent a carry above bit 15 from corrupting LUI’s destination register

Reproduction

Loading a MIPS32 relocatable ELF at 0x1_0000_0000 produced a 17-bit high-half value (0x10000). The unmasked value changed lui $v0, 0 (0x3c020000) into lui $v1, 0 (0x3c030000).

Testing

  • built the standalone arch_mips plugin successfully
  • loaded the reproducer with the rebuilt plugin at 0x1_0000_0000
  • verified the relocated instruction remains lui $v0, 0

@plafosse
plafosse requested a review from zznop August 26, 2026 20:31
@plafosse plafosse self-assigned this Sep 8, 2026
@plafosse
plafosse force-pushed the codex/fix-mips-hi16-relocation branch from 76df56d to bb3a287 Compare September 8, 2026 17:36
@plafosse
plafosse force-pushed the codex/fix-mips-hi16-relocation branch from bb3a287 to 0a1f260 Compare September 9, 2026 13:37
@plafosse
plafosse merged commit 0a1f260 into dev Sep 9, 2026
1 check passed
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.

1 participant