Open
Description
The stucker::grow function appears to cause invalid memory access when the input stack_size is not divisible by the page size. This issue likely originates from a miscalculation in the following code snippet:
let page_size = page_size();
let requested_pages = stack_size
.checked_add(page_size - 1)
.expect("unreasonably large stack requested") / page_size;
let stack_pages = std::cmp::max(1, requested_pages) + 2;
let stack_bytes = stack_pages.checked_mul(page_size);
I have tested my code extensively with various stack_size values and observed that this issue occurs specifically when the input stack_size is not divisible by the page size.
Metadata
Metadata
Assignees
Labels
No labels