Skip to content

elf: add .relr.dyn bootstrap relocation support#69

Merged
fwsGonzo merged 3 commits intovarnish:masterfrom
jlinenkohl:pr-u4-elf-relr-bootstrap
Apr 5, 2026
Merged

elf: add .relr.dyn bootstrap relocation support#69
fwsGonzo merged 3 commits intovarnish:masterfrom
jlinenkohl:pr-u4-elf-relr-bootstrap

Conversation

@jlinenkohl
Copy link
Copy Markdown
Contributor

@jlinenkohl jlinenkohl commented Apr 2, 2026

Summary

  • Add .relr.dyn bootstrap relocation decoding/application and declaration wiring.

Why

  • Modern loaders use RELR; support improves dynamic ELF portability.

Validation

  • cd tests && bash run_unit_tests.sh -R test_elf

Depends on

Stack Context

Test Evidence

  • Date: 2026-04-02
  • Branch-level validation source: phase14_audit baseline sweep
  • Full unit harness: cd tests && bash run_unit_tests.sh -> 8/8 passed
  • Integration tinytest lane: (cd guest/tests && bash build.sh) && ./build/tinytest guest/tests/glibc_test -> passed

PR-Scoped Command

Comment thread lib/tinykvm/machine_elf.cpp Outdated
{
const unsigned bit = __builtin_ctzll(bits);
const address_t reloc_addr = where + bit * sizeof(address_t);
if (memory.safely_within(reloc_addr, sizeof(address_t))) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a place where we want to fail hard if there is an out-of-bounds address, throwing a MachineException instead of silently ignoring it.

@jlinenkohl jlinenkohl force-pushed the pr-u4-elf-relr-bootstrap branch from d584a8a to 9082091 Compare April 5, 2026 19:10
@jlinenkohl
Copy link
Copy Markdown
Contributor Author

Thank you for the feedback. That was a miss on my part.

I rebased this branch onto current master and resolved the merge conflict in machine_elf.cpp.

I also addressed the review feedback to fail hard on out-of-bounds RELR writes instead of silently ignoring them:

  • single RELR target out of bounds now throws MachineException
  • bitmap-derived RELR target out of bounds now throws MachineException

After the rebase + force-push, PR #69 is now mergeable again (GitHub conflict state cleared).

@fwsGonzo fwsGonzo merged commit 555907b into varnish:master Apr 5, 2026
4 checks passed
@fwsGonzo
Copy link
Copy Markdown
Member

fwsGonzo commented Apr 5, 2026

Thanks!

@jlinenkohl jlinenkohl deleted the pr-u4-elf-relr-bootstrap branch April 22, 2026 23:59
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.

2 participants