From a72436067d5f88885e4b32fa7c5d22f1ea8c0756 Mon Sep 17 00:00:00 2001 From: Ben Fennema Date: Tue, 25 Jul 2017 14:37:21 -0700 Subject: [PATCH] init: fix type of 2nd argument passed to prctl prctl(PR_SET_SECUREBITS, ...) expects an unsigned long as its 2nd argument. Passing in a int64_t happens to work with a 64-bit kernel, but does not work with a 32-bit kernel. Bug: 63680332 Test: boot 32-bit kernel; verify services with capabilities can successfully set those capabilties Change-Id: I60250d107a77b54b2e9fe3419b4480b921c7e2f8 Signed-off-by: Ben Fennema --- init/service.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/service.cpp b/init/service.cpp index fc64db69a..e800d328f 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -225,8 +225,8 @@ void Service::SetProcessAttributes() { if (capabilities_.any() && uid_) { // If Android is running in a container, some securebits might already // be locked, so don't change those. - int64_t securebits = prctl(PR_GET_SECUREBITS); - if (securebits == -1) { + unsigned long securebits = prctl(PR_GET_SECUREBITS); + if (securebits == -1UL) { PLOG(FATAL) << "prctl(PR_GET_SECUREBITS) failed for " << name_; } securebits |= SECBIT_KEEP_CAPS | SECBIT_KEEP_CAPS_LOCKED;