jit_allocator: align to the host page size on Linux (crash on 16K page hosts such as Raspberry Pi 5)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
Research direction
Start with align_page() in the jit_allocator source, which hardcodes a 4095 page mask on non-Apple platforms, and check where it is called from. Replace the constant with the host page size from sysconf(_SC_PAGESIZE) on non-Windows targets, keeping the existing Windows path; the attached patch and the getpagesize() version in parallel-n64 show the approach. Done when the allocator is correct on a 16K-page host such as an RPi5 and the 4K behaviour is unchanged.
Written by the indexing model from the issue text.
Description
Symptom:
The ParaLLEl RSP JIT crashes on hosts with 16KB pages (e.g. RPi5).
Cause:
align_page() hardcodes the page size to 4KB (4095) on all platforms except Apple Silicon.
This causes mprotect() to fail when applied to regions not aligned to page boundaries,
and results in an overlap of PROT_EXEC and PROT_READ|PROT_WRITE within the same page.
Fix:
Use sysconf(_SC_PAGESIZE) on all platforms except Windows (patch attached).
parallel-rsp-jit-allocator-host-page-size.patch
Verification:
Confirmed that mupen64plus-next (configured to use Angrylion, which utilizes ParaLLEl RSP) runs correctly on an RPi5.
Reference:
The version of parallel-rsp bundled with parallel-n64 has already been fixed using getpagesize().
https://github.com/libretro/parallel-n64/blob/acd5c9bc5d59a9d44acc03c921bb1f12728e9552/mupen64plus-rsp-paraLLEl/jit_allocator.cpp#L12-L56
The copy bundled with mupen64plus-libretro-nx still has the 4KB value.
Note:
The investigation and the patch were done with the help of Claude (Anthropic).
Thanks
Asai, Shigeaki
- Dominant language
- C
- Stars
- 25
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
JulianKemmerer/PipelineC#395 ·
-
upstream-blocked
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libretro/parallel-n64#858 ·