summaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorDavid Ng <dave@codeaurora.org>2013-10-14 15:23:05 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2013-11-08 14:57:17 -0800
commit3101f064c379471020669b596b8f8f98fded3e76 (patch)
tree382637826bd9fce0fb1917f798828f5b56850bf1 /vm
parente17852495a15ddad079305c725d067ac95e4d655 (diff)
downloadandroid_dalvik-3101f064c379471020669b596b8f8f98fded3e76.tar.gz
android_dalvik-3101f064c379471020669b596b8f8f98fded3e76.tar.bz2
android_dalvik-3101f064c379471020669b596b8f8f98fded3e76.zip
Use 64-bit Linux capabilities when starting Zygote
Enable 64-bit capabilities when starting Zygote to allow >32-bit capabilties to be set, such as CAP_BLOCK_SUSPEND. Change-Id: I2821a2a393dc521c7b99a7283ba17b3ae3b375fd
Diffstat (limited to 'vm')
-rw-r--r--vm/native/dalvik_system_Zygote.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/vm/native/dalvik_system_Zygote.cpp b/vm/native/dalvik_system_Zygote.cpp
index e2b618bab..3dae6de64 100644
--- a/vm/native/dalvik_system_Zygote.cpp
+++ b/vm/native/dalvik_system_Zygote.cpp
@@ -428,19 +428,21 @@ static int setCapabilities(int64_t permitted, int64_t effective)
{
#ifdef HAVE_ANDROID_OS
struct __user_cap_header_struct capheader;
- struct __user_cap_data_struct capdata;
+ struct __user_cap_data_struct capdata[_LINUX_CAPABILITY_U32S_3];
memset(&capheader, 0, sizeof(capheader));
memset(&capdata, 0, sizeof(capdata));
- capheader.version = _LINUX_CAPABILITY_VERSION;
+ capheader.version = _LINUX_CAPABILITY_VERSION_3;
capheader.pid = 0;
- capdata.effective = effective;
- capdata.permitted = permitted;
+ capdata[0].effective = effective & 0xffffffffULL;
+ capdata[0].permitted = permitted & 0xffffffffULL;
+ capdata[1].effective = (uint64_t)effective >> 32;
+ capdata[1].permitted = (uint64_t)permitted >> 32;
ALOGV("CAPSET perm=%llx eff=%llx", permitted, effective);
- if (capset(&capheader, &capdata) != 0)
+ if (capset(&capheader, capdata) != 0)
return errno;
#endif /*HAVE_ANDROID_OS*/