summaryrefslogtreecommitdiffstats
path: root/debuggerd/handler
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2017-02-16 19:22:25 -0800
committerJosh Gao <jmgao@google.com>2017-02-16 20:16:58 -0800
commit5ad965bf41a22929afc4d79fd1988416c192a6a6 (patch)
tree971b0e58d79db7ab263d12dc2892347443337508 /debuggerd/handler
parent2a18b822d50f360b83e9ce3fd822d2650ed3a4db (diff)
downloadcore-5ad965bf41a22929afc4d79fd1988416c192a6a6.tar.gz
core-5ad965bf41a22929afc4d79fd1988416c192a6a6.tar.bz2
core-5ad965bf41a22929afc4d79fd1988416c192a6a6.zip
crash_dump: fix overflow.
`1 << 32` overflows, resulting in bogus PR_CAP_AMBIENT_RAISE attempts, and breaking dumping for processes with capabilities in the top 32 bits. Bug: http://b/35241370 Test: debuggerd -b `pidof com.android.bluetooth` Change-Id: I29c45a8bd36bdeb3492c9f74599993c139821088
Diffstat (limited to 'debuggerd/handler')
-rw-r--r--debuggerd/handler/debuggerd_handler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index 680ba4bee..67c26e2f4 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -202,7 +202,7 @@ static void raise_caps() {
uint64_t capmask = capdata[0].inheritable;
capmask |= static_cast<uint64_t>(capdata[1].inheritable) << 32;
for (unsigned long i = 0; i < 64; ++i) {
- if (capmask & (1 << i)) {
+ if (capmask & (1ULL << i)) {
if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, i, 0, 0) != 0) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "failed to raise ambient capability %lu: %s",
i, strerror(errno));