fix(libSceGLSlimVSH): copy EGL attribute lists in through checked reads #20802
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20802"
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 milescoviello on 2026-11-15T15:47:39Z.
What
eglChooseConfig,eglCreateContextandeglCreatePbufferSurfacewalked the guestattributeslist in place (for (auto p = attributes; *p != EGL_NONE; p += 2)). A list that pointed at unmapped memory, or ran into it beforeEGL_NONE, faulted the host. The library's debt file already lists this.The three loops now read through a small
Attributesreader inEgl.cpp. It copies the list withGuestCopyIn_nid_no_patch, up to 64 words per copy, and never crosses a 4 KiB boundary. A short list costs one checked copy rather than one per word, and the reader never touches a page the in-place loop would not have read.Each value is still read only after its key is accepted. An unknown key therefore still returns
EGL_BAD_ATTRIBUTE(0x3004) even when the word after it is unmapped, as before. An unreadable key or value returnsEGL_BAD_PARAMETER(0x300c), which is the code the debt entry names. Valid lists behave exactly as before.The existing debt entry is rewritten through a
## changefragment underdocs/dev/debt/changes/. It records 0x300c as a host-safety fallback, since console behaviour here is not measured. These are setup calls, so the per-list copy sits off any per-draw path.Tested
Linux (Ubuntu 26.04.1), GCC 15.2, Release.
guest_glslim_attributestest. Each list is placed so it ends on the last word of a page, followed by aPROT_NONEpage (PAGE_NOACCESSon Windows).{SURFACE_TYPE, 1, RENDERABLE_TYPE, 4, NONE}, context{CONTEXT_CLIENT_VERSION, 2, NONE}, and pbuffer{WIDTH, 4, HEIGHT, 2, NONE}. The pbuffer then reports width 4.0x10) returnsEGL_FALSE/EGL_NO_CONTEXT/EGL_NO_SURFACEwith error 0x300c.guest_glslim_query_surface,guest_glslim_state,guest_glslim_eglgetconfigsandguest_glslim_ipc_returnsstill pass.Egl.cppfrommainwith the new test dies with SIGSEGV at address0x10. The page-end valid cases run before that point and pass onmaintoo.tools/check_conventions.pypasses on the branch and this body.tools/debt_fold.py --checkpasses with the fragment applied.git merge-treeagainstmain, against #14212 (debt-file formatting for this library) and against #20798 (eglInitializeoutputs, same file) is clean.Checklist
main; no other open PR implements the same functionsNotImplemented_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 MarcZX10 on 2026-11-15T16:11:40Z.
Review: COMMENTED
Reviewed — comments
This review is incomplete because I could not access the prepared review files or run the repository reader.
What I ran
No commands; the required reader and review folder were not accessible through the available tools.
Results
Findings
Blocking
None verified.
Non-blocking
The change could not be assessed without the diff and targeted source context.
Not verified
The description, commits, diff, manifest, changed files, behavior, and tests were not read or verified.
To get this to a good state
Provide access to the prepared review folder and reader so the review can be completed.