Merge "debuggerd_handler: increase thread stack size."
This commit is contained in:
commit
6ea42a892f
1 changed files with 5 additions and 4 deletions
|
@ -592,19 +592,20 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks) {
|
|||
g_callbacks = *callbacks;
|
||||
}
|
||||
|
||||
void* thread_stack_allocation =
|
||||
mmap(nullptr, PAGE_SIZE * 3, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||
size_t thread_stack_pages = 8;
|
||||
void* thread_stack_allocation = mmap(nullptr, PAGE_SIZE * (thread_stack_pages + 2), PROT_NONE,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||
if (thread_stack_allocation == MAP_FAILED) {
|
||||
fatal_errno("failed to allocate debuggerd thread stack");
|
||||
}
|
||||
|
||||
char* stack = static_cast<char*>(thread_stack_allocation) + PAGE_SIZE;
|
||||
if (mprotect(stack, PAGE_SIZE, PROT_READ | PROT_WRITE) != 0) {
|
||||
if (mprotect(stack, PAGE_SIZE * thread_stack_pages, PROT_READ | PROT_WRITE) != 0) {
|
||||
fatal_errno("failed to mprotect debuggerd thread stack");
|
||||
}
|
||||
|
||||
// Stack grows negatively, set it to the last byte in the page...
|
||||
stack = (stack + PAGE_SIZE - 1);
|
||||
stack = (stack + thread_stack_pages * PAGE_SIZE - 1);
|
||||
// and align it.
|
||||
stack -= 15;
|
||||
pseudothread_stack = stack;
|
||||
|
|
Loading…
Reference in a new issue