From 0993601d5503830ea9b144ec857fceea3fd96a5b Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 12 May 2022 13:23:35 +0900 Subject: [PATCH] Add check for stack_min_addr in bound check with hardware trap (#1166) Add return value check for os_thread_get_stack_boundary before touch_pages in the initialization of memory access bound check with hardware trap. --- core/shared/platform/common/posix/posix_thread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/shared/platform/common/posix/posix_thread.c b/core/shared/platform/common/posix/posix_thread.c index 29839036..fcd7d50e 100644 --- a/core/shared/platform/common/posix/posix_thread.c +++ b/core/shared/platform/common/posix/posix_thread.c @@ -411,6 +411,9 @@ init_stack_guard_pages() uint32 guard_page_count = STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT; uint8 *stack_min_addr = os_thread_get_stack_boundary(); + if (stack_min_addr == NULL) + return false; + /* Touch each stack page to ensure that it has been mapped: the OS may lazily grow the stack mapping as a guard page is hit. */ (void)touch_pages(stack_min_addr, page_size);