summaryrefslogtreecommitdiff
path: root/debuggerd/handler/debuggerd_handler.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-01-22 04:22:18 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-01-22 04:22:18 +0000
commitdd7b0034f18fe2adb98d89bc2d4eeaa7dbd099a2 (patch)
treef7681478921146427edb73e4e70162d18bdfa0b4 /debuggerd/handler/debuggerd_handler.cpp
parent5e8b40f3bb00ced5da858e373345795c519e74dc (diff)
parentdaec2f4f88253e2e6c9ac38c1903e9ef0e1c07fe (diff)
Snap for 6152176 from daec2f4f88253e2e6c9ac38c1903e9ef0e1c07fe to rvc-release
Change-Id: Icf074761856709508e65f435e25a8f64aeab708d
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
-rw-r--r--debuggerd/handler/debuggerd_handler.cpp9
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;