Commit graph

11 commits

Author SHA1 Message Date
Elliott Hughes
4a77a84a55 run-as: improve error messages.
Include the relevant argument when reporting failed calls.

Test: treehugger
Change-Id: I49c691d9edfb825dfee22ab5eb57e7d025c08c21
2020-03-04 18:11:18 -08:00
Elliott Hughes
964932d7ce run-as: improve diagnostics on failure.
Bug: http://b/128523258
Test: manual
Change-Id: I4430a8d309c0e9b5315aaae3e7d223c05b7ea3e5
2019-03-13 11:16:03 -07:00
Yabin Cui
3a60e68b72 run-as: add shared app gid in supplementary groups.
This is to read profile guide compiled oat files of debuggable apps, which is
needed by simpleperf for profiling.

Bug: none
Test: run run-as manually.
Change-Id: I8ec8897b882be650f02124413c7d20ed8b1b444b
2019-01-10 15:08:22 -08:00
Yabin Cui
97e3bb3a94 run-as: add ":fromRunAs" selector in seinfo.
It notifies libselinux that the setcontext request is from run-as.
And libselinux will set current process to runas_app domain, which
can execute app data files.

Bug: 118737210
Test: run CtsSimpleperfTestCases.
Change-Id: Ib94087f910786dd5d2a2b2e3b1bf76dfa7131ced
2018-11-06 15:31:59 -08:00
Yabin Cui
bcbffddb10 run-as: Use 2-space clang-format.
Bug: none
Test: none.
Change-Id: I8fc2f9a534675347bae5af0ce12b0bf3d7c32d55
2018-11-06 11:18:44 -08:00
Nicholas Sauer
0c5411c7ca Fix run-as for non-owner users
bug: 118501138
bug: 80126373
Test: cts-tradefed run cts-dev -a arm64-v8a -m CtsJvmtiRunTest1908HostTestCases
Change-Id: Iee25afbffc6990b46f508bfe8a9953bd2a35d118
2018-11-05 08:58:19 -08:00
Luis Hector Chavez
ef62f3fcbb Add a way to disable run-as at runtime
This change adds the ro.boot.disable_runas system property, that when
set, disables the run-as command. This is done to reduce the surface
area of programs that have file based capabilities in Chrome OS, and
what they can do when running in non-developer mode.

Bug: 31630024
Test: run-as still works in aosp_sailfish
Test: run-as still works in Android in Chrome OS (in developer mode)
Change-Id: Iaf1d6f9ceb65081b7a9e17b9b91d8855e4080133
2018-06-27 11:09:28 -07:00
Jorge Lucangeli Obes
8c27e19c1c run-as: Keep supplementary groups.
This broke TCP debugging because processes don't inherit the AID_INET
group.

Bug: 67058466
Test: adb shell run-as com.example.native_activity groups prints "inet".
Change-Id: Ieb461dccda8611057bb2d16334e584eb5e57c8b1
2017-09-29 15:34:23 -04:00
Jeff Sharkey
dff44709cf Define range of GIDs for cached app data.
To support upcoming disk usage calculation optimizations, this change
creates a new GID for each app that will be used to mark its cached
data.  We're allocating these unique GIDs so that we can use
quotactl() to track cached data on a per-app basis.

This change also tightens up the implementation of both the cache
and shared GID calculation to ensure that they stay inside the valid
ranges, and includes tests to verify.

Test: builds, boots, tests pass
Bug: 27948817
Change-Id: Ie4377e5aae267f2da39a165888139228995987cb
2016-12-13 13:28:08 -07:00
Jorge Lucangeli Obes
a377ff0d4a run-as: Use Minijail for privilege dropping.
Arguably, we don't need a ScopedMinijail for a program that only execs,
but I'd rather keep the code consistent and have all uses of Minijail
be good examples.

Bug: 30156807

Change-Id: I08a968835e0f3e2afcd5e7736626edbed658cde2
2016-07-19 11:03:52 -04:00
Elliott Hughes
0c8bf5798f Switch run-as to libpackagelistparser.
We already have to have a Java and a native implementation; we don't
need _two_ native implementations.

Change-Id: I0201205ce5079ef9c747abc37b0c8122cf8fb136
2016-07-07 16:50:32 -07:00