kern: add new overflow checks on KMemoryRegions

This commit is contained in:
Michael Scire authored and SciresM committed 2020-12-02 06:43:37 -08:00
1 parent 748893fe77
commit 0a1465f198
8 files changed
+32 -1

No files matched your search

@@ -207,6 +207,7 @@ namespace ams::kern {
Result KThread::InitializeThread(KThread *thread, KThreadFunction func, uintptr_t arg, KProcessAddress user_stack_top, s32 prio, s32 core, KProcess *owner, ThreadType type) {
/* Get stack region for the thread. */
const auto &stack_region = KMemoryLayout::GetKernelStackRegion();
MESOSPHERE_ABORT_UNLESS(stack_region.GetEndAddress() != 0);
/* Allocate a page to use as the thread. */
KPageBuffer *page = KPageBuffer::Allocate();