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 <fennema@google.com>
(cherry picked from commit a72436067d)
This commit is contained in:
Ben Fennema 2017-07-25 14:37:21 -07:00
parent 684f4883b3
commit 7d7e7cdf34
1 changed files with 2 additions and 2 deletions

View File

@ -245,8 +245,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;