kern: add new overflow checks on KMemoryRegions

This commit is contained in:
Michael Scire 2020-12-01 17:14:23 -08:00 committed by SciresM
parent 748893fe77
commit 0a1465f198
8 changed files with 32 additions and 1 deletions

View file

@ -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();