Skip to content

[DYNAREC] Fixed callret=2 with always_test out-of-bounds read#3790

Merged
ptitSeb merged 1 commit intoptitSeb:mainfrom
ksco:fix-callret2-oob
Apr 18, 2026
Merged

[DYNAREC] Fixed callret=2 with always_test out-of-bounds read#3790
ptitSeb merged 1 commit intoptitSeb:mainfrom
ksco:fix-callret2-oob

Conversation

@ksco
Copy link
Copy Markdown
Collaborator

@ksco ksco commented Apr 18, 2026

With callret=2 and always_test=1, CALLRET_RET in pass2 skips writing callret entries, thus callret_size=0. But CALLRET_GETRET in pass3 still reads callrets[0], which is an out-of-bounds read. The garbage offset becomes the native return address, causing RET to jump to a wrong address. I had this issue on LoongArch with 16KiB page size kernel, but this seems universal so all three backends are changed.

With callret=2 and always_test=1, CALLRET_RET in pass2 skips writing callret entries, thus callret_size=0. But CALLRET_GETRET in pass3 still reads callrets[0], which is an out-of-bounds read. The garbage offset becomes the native return address, causing RET to jump to a wrong
address. I had this issue on LoongArch with 16KiB page size kernel, but this seems universal so all three backends are changed.
@ptitSeb ptitSeb merged commit 599360c into ptitSeb:main Apr 18, 2026
28 checks passed
@ksco ksco deleted the fix-callret2-oob branch April 18, 2026 16:58
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