fix(libcairo): fault matrix pointers that Cairo dereferences #23881
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23881"
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 brianmatute011 on 2026-11-19T20:40:29Z.
What
Moves the four throw sites in
core/libs/prx/libcairo/Matrix.cppfromNotImplemented_nid_no_patchtoGuestFault_nid_no_patch, the helper added by #23849. Part of #23391.Reason: Cairo 1.18.0
src/cairo-matrix.c, the version these exports run, reads and writes the matrix and coordinate pointers without a check, for example*x += matrix->x0;incairo_matrix_transform_point. An unreadable or unwritable pointer is therefore undefined upstream. The four sites only fire on such a pointer:ReadGuestandWriteGuest, whenGuestCopyIn_nid_no_patchorGuestCopyOut_nid_no_patchfails;GuestWritable_nid_no_patchchecks on the coordinate outputs ofcairo_matrix_transform_distanceandcairo_matrix_transform_point.Behaviour does not change: the same inputs still throw before any guest write, and every valid call takes the same path as before. Only the exception message changes, and these calls no longer count as unimplemented exports.
GuestCairoMatrixGuestPointers.cppnow also requires that each rejected call leavesNotImplementedCalls_nid_no_patch()unchanged. The reason is added to the pendinglibcairodebt fragment that already changes theMatrix.cppentry (codex-cairo-matrix-point-alias.md), becausedebt_fold.pyrefuses a second fragment on the same entry.tools/progress.py --module libcairo: 108 of 161 before, 118 of 161 after. The ten functions now counted arecairo_matrix_init,cairo_matrix_init_identity,cairo_matrix_init_translate,cairo_matrix_multiply,cairo_matrix_translate,cairo_matrix_scale,cairo_matrix_rotate,cairo_matrix_invert,cairo_matrix_transform_distanceandcairo_matrix_transform_point.This branch carries the commit of #23849 until that pull request is merged. Only the last commit belongs to this one.
Tested
Ubuntu 24.04.5, kernel 7.0.0, GCC 13.3.0, Release, on
main87ee89b036with #23849 (4a618c6db0) applied:ctest -R cairo: 35 of 35 pass.NotImplemented_nid_no_patch,guest_cairo_matrix_guest_pointersfails on the new counter check; withGuestFault_nid_no_patchit passes.python3 tools/debt_fold.py --check: passes.python3 tools/check_conventions.py --base upstream/main: all checks passed.python3 tools/pr_overlap.py --branch feat/libcairo-matrix-guest-fault --base main: the only overlaps reported are in the files of #23849. No open pull request touchesMatrix.cpp,GuestCairoMatrixGuestPointers.cppor the debt fragment. #15208, #18404 and #19529 editdocs/dev/debt/libcairo.md, but not theMatrix.cppentry.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T21:05:19Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
820e3ffc66:tools/check_conventions.pypassed.guest_cairo_matrix_guest_pointer_testsbuilt cleanly.guest_cairo_matrix_guest_pointers):core/libs/prx/libc/include/General.hpp,core/libs/prx/libc/src/General.cpp,core/libs/prx/libcairo/Matrix.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T21:26:20Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed head changes Cairo matrix pointer rejection to use the guest fault path and updates progress classification; no blocking defect was verified, but tests were not run in this review.
What I ran
Inspected the prepared diff and changed source at head
820e3ffc662fb4d2cbabc0563a74b037b87aa386using therepo_read.pyreader tools. No build or tests were run.Results
Findings
Blocking
None identified in the inspected changes.
Non-blocking
None.
Sources
Reviewed changed lines in
Matrix.cpp,General.cpp,progress.py, andtest_progress.py, alongside the remaining changed files listed below.Not verified
No build or tests were run. The PR description reports Cairo tests, a negative control, debt validation, convention checks and overlap checks; these results were not independently verified. Read:
AGENTS.md,CONTRIBUTING.md,core/libs/prx/libc/include/General.hpp,core/libs/prx/libc/src/General.cpp,core/libs/prx/libcairo/Matrix.cpp,core/libs/tests/GuestCairoMatrixGuestPointers.cpp,docs/dev/PROGRESS.md,docs/dev/debt/changes/codex-cairo-matrix-point-alias.md,tools/progress.py(relevant changed sections), andtools/tests/test_progress.py(new tests). The manifest marks all changed files included; no excluded files were listed. Full-file text fortools/progress.pyandtools/tests/test_progress.pywas not read.To get this to a good state
Nothing is required. Optional: run the focused Cairo tests and progress scanner tests on this head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T07:33:03Z.
Review: COMMENTED
Reviewed — no blocking findings
The pointer fault handling and progress classification changes appear consistent with the stated goal; I did not run the reported checks.
What I ran
Reviewed head
d113d50fd27e6a18f9ca6cdc149f99b20c777477usingrepo_read.pyto inspect the prepared diff and changed source. No test, build, or merged-preview commands were run. The author reports Cairo tests and repository checks passed; those results were not independently verified.Files read:
AGENTS.md,CONTRIBUTING.md,core/libs/prx/libc/include/General.hpp,core/libs/prx/libc/src/General.cpp,core/libs/prx/libcairo/Matrix.cpp,core/libs/tests/GuestCairoMatrixGuestPointers.cpp,docs/dev/PROGRESS.md,docs/dev/debt/changes/codex-cairo-matrix-point-alias.md,tools/progress.py, andtools/tests/test_progress.py. The manifest marks all 10 changed files as included; no excluded files were listed in the manifest.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build and test results in the PR description, including the reported negative control, were not independently run. Console behavior for invalid pointers is reported as unmeasured in the debt entry.
To get this to a good state
Nothing is required. Optional: retain the reported check results with the PR for reviewers to verify.
Sources
Changed behavior reviewed in Matrix.cpp at the reviewed commit, General.cpp at the reviewed commit, and progress.py at the reviewed commit.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T14:34:36Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected diff moves invalid guest-pointer failures to
GuestFault_nid_no_patchand adds checks that those calls do not count as unimplemented.What I ran
Reviewed head
cc312acf156f97074dca3cbcd13d553621cd3710using the prepared diff and pinned reader. No test commands were run; the commands reported in the PR description are author-reported. I read all ten changed files listed as reviewed in the manifest.files.jsonwas not available through the reader, so excluded-file details are not verified.Results
files.jsonunavailableFindings
Blocking
None.
Non-blocking
None.
Not verified
Tests and prechecks were not run on this head. Excluded-file inventory was not verified because
files.jsonwas unavailable. Console behavior for invalid pointers remains unmeasured, as recorded in the debt fragment.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T14:57:19Z.
Review: COMMENTED
Built and ran
guest_cairo_matrix_guest_pointerson Linux with this head integrated. It passed. I checked the distinction between matrix inputs read by Cairo and guest destinations that the wrapper writes back to after the operation.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T02:26:32Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes consistently classify rejected guest-memory accesses as guest faults, and all three changed files were read at
96aca5c46b367a7cca7abbb3fd4e87c1adf802a4.What I ran
Read the prepared diff and all three changed files. Used
repo_read.pyat the pinned head for the guest fault implementation. No tests or builds were run.Results
Negative control
Not run; the regression test was not executed.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
No tests or builds were run, and guest fault behavior on a physical console was not verified. Files read:
core/libs/prx/libcairo/Matrix.cpp,core/libs/tests/GuestCairoMatrixGuestPointers.cpp, anddocs/dev/debt/changes/codex-cairo-matrix-point-alias.md. All files listed as reviewed were read; none were excluded.To get this to a good state
Nothing is required.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.