diff options
| author | 2017-11-30 04:22:52 +0000 | |
|---|---|---|
| committer | 2017-11-30 04:22:52 +0000 | |
| commit | 7a3e5af2b92b3d94e73fd7e4b0ca6817c86c510b (patch) | |
| tree | e36b0a6f39d68688cef7a88c0f57de7761def131 /cmds/installd/InstalldNativeService.cpp | |
| parent | 5d87e2fde3a41457b808e8c7233c4a983a21029d (diff) | |
| parent | d87138a5d186fd008b5c7b6b205dbc68601410a4 (diff) | |
Merge "Fixup existing profile directories during upgrades" am: 3367b569bf
am: d87138a5d1
Change-Id: Ib77f6de6fab4ff362350473c29906041a9f55f3e
Diffstat (limited to 'cmds/installd/InstalldNativeService.cpp')
| -rw-r--r-- | cmds/installd/InstalldNativeService.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp index daa744f859..04e39f9bac 100644 --- a/cmds/installd/InstalldNativeService.cpp +++ b/cmds/installd/InstalldNativeService.cpp @@ -373,13 +373,22 @@ static bool prepare_app_profile_dir(const std::string& packageName, int32_t appI const std::string ref_profile_path = create_primary_reference_profile_package_dir_path(packageName); - // dex2oat/profman runs under the shared app gid and it needs to read/write reference - // profiles. - if (fs_prepare_dir_strict( - ref_profile_path.c_str(), 0701, shared_app_gid, shared_app_gid) != 0) { + + // Prepare the reference profile directory. Note that we use the non strict version of + // fs_prepare_dir. This will fix the permission and the ownership to the correct values. + // This is particularly important given that in O there were some fixes for how the + // shared_app_gid is computed. + // + // Note that by the time we get here we know that we are using a correct uid (otherwise + // prepare_app_dir and the above fs_prepare_file_strict which check the uid). So we + // are sure that the gid being used belongs to the owning app and not someone else. + // + // dex2oat/profman runs under the shared app gid and it needs to read/write reference profiles. + if (fs_prepare_dir(ref_profile_path.c_str(), 0770, AID_SYSTEM, shared_app_gid) != 0) { PLOG(ERROR) << "Failed to prepare " << ref_profile_path; return false; } + return true; } |