Merge pull request #2717 from SciresM/unmirror_memory

Restore memory perms on svcUnmapMemory/UnloadNro
This commit is contained in:
bunnei 2019-07-11 14:57:20 -04:00 committed by GitHub
commit 79c382fafd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 7 deletions

View file

@ -318,7 +318,14 @@ static ResultCode UnmapMemory(Core::System& system, VAddr dst_addr, VAddr src_ad
return result;
}
return vm_manager.UnmapRange(dst_addr, size);
const auto unmap_res = vm_manager.UnmapRange(dst_addr, size);
// Reprotect the source mapping on success
if (unmap_res.IsSuccess()) {
ASSERT(vm_manager.ReprotectRange(src_addr, size, VMAPermission::ReadWrite).IsSuccess());
}
return unmap_res;
}
/// Connect to an OS service given the port name, returns the handle to the port to out