Skip to content

fix(libkernel): map fixed no-overwrite requests into a reserved range - #296

Closed
Ryongen wants to merge 1 commit into
simnJS:AnyKytyfrom
Ryongen:fix/libkernel-no-overwrite-reserved
Closed

Ryongen wants to merge 1 commit into
simnJS:AnyKytyfrom
Ryongen:fix/libkernel-no-overwrite-reserved

Conversation

@Ryongen

@Ryongen Ryongen commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

What

FixedNoOverwriteConflict treats a reserved, unmapped range as free for MAP_FIXED | MAP_NO_OVERWRITE, but RemapFixedIntoRegistered and DoReserveVirtual still refused every NO_OVERWRITE request, so a reserve or map inside an existing reservation fell through to RequireAvailable and threw fixed mapping ... overlaps a registered guest allocation. Both paths now take the remap when the whole range is reserved; a range that holds a live mapping still fails with ENOMEM as before (e9c8664).

Tested

Windows 10 22H2, WinLibs GCC 15.2.0, LLVM 21.1.8.

  • GuestMemory.cpp gains CheckNoOverwriteFillsReservedRange: a 0x90 reserve and a 0x90 direct map inside a 4-page reservation succeed at the requested address, and a 0x90 reserve over the now-mapped page still returns ENOMEM. Run on its own it passes with the change and throws fixed mapping 0x200004000+0x4000 overlaps a registered guest allocation 0x200000000+0x10000 without it.
  • The full guest_memory test stops on this machine at RequireResidentMapping (VirtualQuery state), on clean AnyKyty as well, before reaching the new check; that failure is unrelated to this change.
  • python tools/check_conventions.py --base origin/AnyKyty and tools/check_kyty_settings.py: passed.
  • End to end: Grand Theft Auto V (PPSA38500 01.002.001) reserves 0xb000000000+0x4800000000, then calls sceKernelReserveVirtualRange(0xf000000000, 0xd00000, 0x400090) inside it about 12 s in, and aborted there. With the change it runs on and renders for about 30 s until kyty: bindless S#/T# loaded with s_buffer_load at a runtime offset stops resource tracking ("GetSamplerResource dword 0 is not a valid runtime value") #294.

Checklist

The conflict check already treats reserved space as free, but the remap paths refused NO_OVERWRITE, so a reserve or map inside an existing reservation threw instead of succeeding.
@simnJS

simnJS commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Merged into AnyKyty as 441382ef20 (authorship kept), in today's batch together with the sync of upstream main eba6750e46. CI green on Linux, sanitizers and Windows, and the in-game regression run was clean. Thank you!

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