diff options
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-01-21 20:27:17 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-01-21 20:27:17 +0000 |
commit | 6f55d1778a0f9d45cd8728f2632f10eb86c24ae4 (patch) | |
tree | 69bc2536255ac9fbed8363073f188db00cc6daff /debuggerd/handler/debuggerd_handler.cpp | |
parent | 0f5b17b687fd8bc83fbeedfe25fdec533e32820f (diff) | |
parent | 6cd321397239b0a702a623a45680840fa350de5d (diff) |
Merge "debuggerd_handler: increase thread stack size." am: 6ea42a892f am: 1c698729df am: 6cd3213972
Change-Id: Ibe69c77ba4668139eae58a92c8a9869fa59e08f4
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
-rw-r--r-- | debuggerd/handler/debuggerd_handler.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp index 6e0128993..f8192b52d 100644 --- a/debuggerd/handler/debuggerd_handler.cpp +++ b/debuggerd/handler/debuggerd_handler.cpp @@ -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; |