Skip to content

Fix ArmV8 segment boundary crash#516

Open
ViRb3 wants to merge 1 commit intoSamboyCoding:developmentfrom
ViRb3:segment-boundary
Open

Fix ArmV8 segment boundary crash#516
ViRb3 wants to merge 1 commit intoSamboyCoding:developmentfrom
ViRb3:segment-boundary

Conversation

@ViRb3
Copy link
Contributor

@ViRb3 ViRb3 commented Feb 14, 2026

I hit another regression with the binary from #515.

This was caused by 8478bd6, although in reality segment boundaries were never handled properly and this worked before "by accident". The error:

Unhandled exception. System.InvalidOperationException: NSO: Address 0x2B83E14 is not present in any of the segments. Known segment ends are (hex) 2B83E14, 446F004, 49AF3F8

I checked section dump:

         file off file len mem off  mem len  bss/algn
0 [r-x]:      100  2b83e14        0  2b83e14      100
1 [r--]:  2b84100  18eb004  2b84000  18eb004        0
2 [rw-]:  4470100   53f3f8  4470000   53f3f8   409c08
.rodata-relative:
  .dynstr:   c34520     b80d
  .dynsym:   c2e1f0     6330

So, it looks like we are calculating the end of the method body to be the address just after .text ends. This is, in fact, the correct address, but it does also legitimately fall just outside the segment bounds. This is why we now get InvalidOperationException exception. Before, because of the <=, this would work fine, but then our segment bounds were off by 4 bytes.

To fix properly, I resolve the last instruction (always valid) and then add +4 in raw space, which won't trip the exception.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 22019470829

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 34.4%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs 0 2 0.0%
Totals Coverage Status
Change from base Build 22018529184: 0.0%
Covered Lines: 4212
Relevant Lines: 10896

💛 - Coveralls

@ViRb3
Copy link
Contributor Author

ViRb3 commented Feb 14, 2026

@WitherOrNot I'm pretty sure this is correct but tagging to verify just in case (check your referenced commit in first post).

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