loader: check DT_OS_SYMTAB against its backing buffer #1370
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1370
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1370/head"
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?
@HamsterCL on GitHub · 2026-10-10 12:51 UTC · original
HamsterCL:fix/dynlib-symtab-extent→main· +40 −1 · 3 files · 2 commits · closed without mergingSummary
DT_OS_SYMTAB/DT_OS_SYMTABSZcome from the guest and were used to index the symbol table without checking that the table fits in memory.Elf64now remembers the size of thePT_OS_DYNLIBDATAsegment (GetDynamicDataSize()).DT_SYMTAB) and its size is a multiple ofsizeof(Elf64_Sym).Split out of the closed #1329.
@coderabbitai[bot] on GitHub · 2026-10-10 12:57 UTC · original · edited 2026-10-10 14:58 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
04446adf-015b-4992-808d-b2d45280debd📥 Commits
Reviewing files that changed from the base of the PR and between
d9a5d06802andd31c4611a0.📒 Files selected for processing (1)
src/loader/runtimeLinker.cpp🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
📝 Walkthrough
📝 Walkthrough
Walkthrough
The ELF loader tracks the size of its dynamic-data buffer and exposes it through a public accessor. The runtime linker checks that a present symbol table consists of whole
Elf64_Symentries and fits within its backing region. ForDT_OS_SYMTAB, it checks the dynamic-data buffer. For standardDT_SYMTABwithout a declared size, it can derive the symbol count fromDT_HASHafter checking the hash-header bounds.Priority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
d31c4The new symbol-table bounds checks do not leave an established PR-introduced issue blocking merge. Unchecked relocation indices remain a separate, pre-existing concern.
Pre-merge checks |
4 |
1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
#1329is closed and supplies historical context only. No active directly linked issue supplies coding requirements for this pull request.Elf64records thePT_OS_DYNLIBDATAsize, andRuntimeLinker::ParseProgramDynamicInfobounds-checks the symbol table and derives the SysV size fr…Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -1907,0 +1937,4 @@EXIT_NOT_IMPLEMENTED(symtab_offset > region_size ||program->dynamic_info->symbol_table_total_size >region_size - symtab_offset);}@coderabbitai[bot] on GitHub · 2026-10-10 12:57 UTC · original · edited 2026-10-10 13:19 UTC
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 10529
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 10715
Derive the standard symbol-table size before relocation.
ParseProgramDynamicInforeadsDT_HASHonly as a pointer. It does not readnchainintosymbol_table_total_size; that field is set only by project-specificDT_OS_SYMTABSZ. A standard SysV ELF can omit that tag, so the field remains zero and the current checks accept it.CreateSymbolDatabasethen iterates zero entries, whileGetRelocationInfodirectly evaluatessymbol_table[symbol]. A symbol-bearing relocation can therefore read beyond the actual symbol table.Do not reject zero in the standard
DT_SYMTABbranch. Derive the symbol count from validatedDT_HASHmetadata, or another validated standard source, and use it for the size and bounds checks.✅ Addressed in commit
d31c461@coderabbitai[bot] on GitHub · 2026-10-10 12:57 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
e16e3828-2a5f-4ddb-a3ce-e8688d763066📥 Commits
Reviewing files that changed from the base of the PR and between
307fdcf7adandd9a5d06802.📒 Files selected for processing (3)
src/loader/elf.cppsrc/loader/elf.hsrc/loader/runtimeLinker.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
@HamsterCL on GitHub · 2026-10-10 14:58 UTC · original
@coderabbitai review
@coderabbitai[bot] on GitHub · 2026-10-10 14:58 UTC · original
⚠️ Action not completed
Already reviewed the last commit. Use
@coderabbitai full reviewto rerun a review of the entire changeset.Pull request closed