diff options
author | Steven Laver <lavers@google.com> | 2020-02-05 04:53:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-02-05 04:53:02 +0000 |
commit | 6a30c5f691c96d3d75cd8ac85dd76696ba345b7b (patch) | |
tree | fa618ed3d605e46d9786cc80fd46a01c3010f3f4 /debuggerd/handler/debuggerd_handler.cpp | |
parent | 4c613f7acaecddbe73747ff5d7ed31b4bf038a19 (diff) | |
parent | b60e31a87f1ca66a3e7bb59bafd53194069ce132 (diff) |
Merge "Merge RP1A.200123.001" into r-keystone-qcom-dev
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 0e36fdb2d..34dc45f36 100644 --- a/debuggerd/handler/debuggerd_handler.cpp +++ b/debuggerd/handler/debuggerd_handler.cpp @@ -596,19 +596,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; |