From d635d1896761fc71b2dedfdf2df047d1bca8a5c1 Mon Sep 17 00:00:00 2001 From: Dean Galvin Date: Sat, 10 Oct 2026 23:00:41 +1300 Subject: [PATCH] test(agc): check that a Linux page query is answered from the page table Revoke a checked arena page with mprotect behind the registry and check that the stored answer comes back, so the test fails without the cache. Pass the gpu argument that GuestAllocations::Mutation::Add and Protect now take. --- core/libs/prx/libSceAgcDriver/tests/GuestAllocations.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/tests/GuestAllocations.cpp b/core/libs/prx/libSceAgcDriver/tests/GuestAllocations.cpp index de79f6a57..ad2314a04 100644 --- a/core/libs/prx/libSceAgcDriver/tests/GuestAllocations.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/GuestAllocations.cpp @@ -193,19 +193,22 @@ void RunUnmappedGapTests() { Require(mmap(guest, 2 * page, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0) == guest, "cannot map the arena page test pages"); { GuestAllocations::Mutation mutation; - mutation.Add(guest, 2 * page, true, true); + mutation.Add(guest, 2 * page, true, true, true); } Require(GuestMemory::Accessible(guest, page, true), "a mapped arena page is not writable"); + Require(mprotect(guest, page, PROT_NONE) == 0, "cannot revoke the arena test page behind the registry"); + Require(GuestMemory::Accessible(guest, page, true), "a checked arena page was queried again instead of read from the page table"); + Require(mprotect(guest, page, PROT_READ | PROT_WRITE) == 0, "cannot restore the arena test page behind the registry"); Require(mprotect(guest + page, page, PROT_READ) == 0, "cannot protect the arena test's second page"); Require(!GuestMemory::Accessible(guest + page, page, true), "a check stored arena pages outside its range"); { GuestAllocations::Mutation mutation; - mutation.Protect(guest + page, page, true, true, [&] { Require(mprotect(guest + page, page, PROT_READ | PROT_WRITE) == 0, "cannot restore the arena test's second page"); }); + mutation.Protect(guest + page, page, true, true, true, [&] { Require(mprotect(guest + page, page, PROT_READ | PROT_WRITE) == 0, "cannot restore the arena test's second page"); }); } Require(GuestMemory::Accessible(guest, 2 * page, true), "mapped arena pages are not writable"); { GuestAllocations::Mutation mutation; - mutation.Protect(guest, page, true, false, [&] { Require(mprotect(guest, page, PROT_READ) == 0, "cannot protect the arena test page"); }); + mutation.Protect(guest, page, true, false, true, [&] { Require(mprotect(guest, page, PROT_READ) == 0, "cannot protect the arena test page"); }); } Require(!GuestMemory::Accessible(guest, page, true) && GuestMemory::Accessible(guest, page) && GuestMemory::Accessible(guest + page, page, true), "an arena page protected through the registry kept its old access"); {