test(relinker): cover zero length and section overflow in eh_frame FDE record #14513
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14513"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by slopgobblercobbler on 2026-11-01T15:22:39Z.
What
Add unit tests for .eh_frame FDE records with zero length and length overflowing remaining section size in
core/relinker/relinker/tests/UnwindRecordBoundsTests.cpp.Tested
Built and executed
unwind_record_bounds_testssuccessfully (32 test cases passed). Ran conventions check tool with 0 findings.Checklist
NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T01:26:42Z.
Review: DISMISSED
Both new cases pass for a different reason than the one they name, so they don't cover zero-length or overflowing FDEs.
Windows 11, WinLibs GCC 15.2.0 r7, relinker-only Release. Head 91fbd2bd9d merged into upstream/main
93dbd0f82a:unwind_record_bounds_testsprints32 unwind record cases passed. I madecatch (const std::exception&)printwhat(), and both cases throw:The cases reuse
loadandeh, but an earlier case inmain()setseh.MappedAddress = 0xFFFFFFFFFFFF0000ULL(line 76). So the reader rejects the.eh_frame_hdraddress before it reaches the FDE at offset 96, and the length written there is never read. Because the catch accepts any exception, nothing notices.Suggested fix, as #14573 does for its CIE cases: build fresh
ProgramHeaders for these two cases, and check the message, e.g.Strict filter: unsupported FDE record sizeforlength < 8(EhFrameReader.cpp:210), and the section-bounds message for 1000. With that, disabling either check should make the test fail.Note:
.eh_framedefines a zero length field as the terminator. If the reader rejecting a zero length FDE is intended, a debt or test line saying so would help.Also: #14513, #14527 and #14573 all replace the same
std::cout << "30 unwind record cases passed\n";line with different counts, so whichever merges second and third will conflict there.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:46:47Z.
Review: COMMENTED
Reviewed — no blocking findings
The two new rejections match the reader: an FDE record length below 8 is rejected as an unsupported FDE record size (
EhFrameReader.cppline 210), and a length that runs past the buffer is rejected by the range check (checkedRangeEnd, line 211). The test catchesstd::exception, so it passes for any rejection, including unrelated ones.What I ran
91fbd2bd9d53e49d08507fb96db41d1649b62d39; basef2d874c1fdccf781c0fa5d86619bb5dd8894b958. 1 file:core/relinker/relinker/tests/UnwindRecordBoundsTests.cpp(test-only; the existing test file already runs in the relinker jobs).core/relinker/relinker/src/analysis/UnusedNidFilter/EhFrameReader.cpp(lines 159-165 and 210-234 at base).Results
Read-only check output
Precheck was not run: this session does not run code from PR heads. Hosted:
gh api repos/boykopovar/AnyPS5/commits/91fbd2bd9d53e49d08507fb96db41d1649b62d39/check-runs.Negative control
Not run here. A negative control needs a build, and code from this head is not run here.
Findings
Blocking
None.
Non-blocking
std::exceptionand do not check the message, so they would also pass for an unrelated failure. Asserting the "unsupported FDE record size" message for the zero case would pin the intended path.UnwindRecordBoundsTests.cpp, so they will conflict when merged; one should land first and the others be rebased.Sources
github.com/boykopovar/AnyPS5@91fbd2bd9d/core/relinker/relinker/tests/UnwindRecordBoundsTests.cppgithub.com/boykopovar/AnyPS5@f2d874c1fd/core/relinker/relinker/src/analysis/UnusedNidFilter/EhFrameReader.cpp (L159-L234)Not verified
To get this to a good state