OSDN Git Service

Use init to set capabilities
authorJohan Redestig <johan.redestig@sonymobile.com>
Wed, 30 Nov 2016 11:55:42 +0000 (12:55 +0100)
committerJorge Lucangeli Obes <jorgelo@google.com>
Tue, 13 Dec 2016 16:14:15 +0000 (11:14 -0500)
commitaafb4e2754ad2a15fedb0efe0faf97d8c259380b
treef4e2b429ef581a23c1ed3d88475c56b0b4f50b62
parent0078c8d7997afae1f9a250e3e03a474697098a4a
Use init to set capabilities

With the minijail code the groups set in the rild.rc are lost when
switching user. The reason for starting as root was to be able to set
capabilities, since that code was written init has gain the ability
to set capabilities at service declaration so use that instead so we
dont even have to start as root.

Test: cat /proc/`pgrep rild`/status
Before change:

Name: rild
...
Uid: 1001 1001 1001 1001
Gid: 1001 1001 1001 1001
...
Groups:
...
CapInh: 0000001000003000
CapPrm: 0000001000003000
CapEff: 0000001000003000
CapBnd: 0000001000003000
CapAmb: 0000000000000000
...

After change:

Name:   rild
...
Uid:    1001    1001    1001    1001
Gid:    1001    1001    1001    1001
...
Groups: 1005 1007 2001 3003 3009 3010 9998
...
CapInh: 0000001000003000
CapPrm: 0000001000003000
CapEff: 0000001000003000
CapBnd: 0000001000003000
CapAmb: 0000001000003000
...

Bug: 33443755
Change-Id: Iac8aea697ac24417edecb4c0061e56821d3dc59e
rild/Android.mk
rild/rild.c
rild/rild.rc