From 1f44a9c4bf2a59272fc620e33ff7d39775443f30 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 28 Mar 2024 03:43:22 -0700 Subject: [PATCH] kern: fix whoops in new page table logic --- libraries/libmesosphere/source/kern_k_page_table_base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/libmesosphere/source/kern_k_page_table_base.cpp b/libraries/libmesosphere/source/kern_k_page_table_base.cpp index 92aad904c..2e90d924e 100644 --- a/libraries/libmesosphere/source/kern_k_page_table_base.cpp +++ b/libraries/libmesosphere/source/kern_k_page_table_base.cpp @@ -301,7 +301,7 @@ namespace ams::kern { /* If aslr is enabled, randomize the current region order. Otherwise, sort by type. */ if (m_enable_aslr) { for (size_t i = 0; i < cur_alloc_count - 1; ++i) { - std::swap(region_layouts[i], region_layouts[KSystemControl::GenerateRandomRange(i, cur_alloc_count - 1)]); + std::swap(region_layouts[cur_region_index + i], region_layouts[cur_region_index + KSystemControl::GenerateRandomRange(i, cur_alloc_count - 1)]); } } else { for (size_t i = 0; i < cur_alloc_count - 1; ++i) {