Skip to content

Add word alignment check to ppu_register_function_at - #17718

Merged
elad335 merged 5 commits into
RPCS3:masterfrom
FeTetra:sdwpm-reinterpret-fix
Nov 21, 2025
Merged

elad335 merged 5 commits into
RPCS3:masterfrom
FeTetra:sdwpm-reinterpret-fix

Conversation

@FeTetra

@FeTetra FeTetra commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

This adds a check to the ppu_register_function_at function in PPUThread.cpp which checks to see if size is aligned to a word. This fixes some crashes in interpreter mode when calling functions like sys_dbg_write_process_memory to write data which may not be an instruction.

@elad335

elad335 commented Nov 20, 2025 •

Copy link
Copy Markdown
Contributor

I think you just need to:

size = utils::align<u32>(size + addr % 4, 4);
addr &= -4;

At the very beginning of the function, before size == 0 check.
It's wrong to skip this function, because unaligned size may still point to instructions.

@elad335
elad335 merged commit 9deb6cd into RPCS3:master Nov 21, 2025
8 of 9 checks passed
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