Loading cmds/installd/commands.cpp +12 −6 Original line number Original line Diff line number Diff line Loading @@ -70,6 +70,12 @@ static bool property_get_bool(const char* property_name, bool default_value = fa return strcmp(tmp_property_value, "true") == 0; return strcmp(tmp_property_value, "true") == 0; } } // Keep profile paths in sync with ActivityThread. constexpr const char* PRIMARY_PROFILE_NAME = "primary.prof"; static std::string create_primary_profile(const std::string& profile_dir) { return StringPrintf("%s/%s", profile_dir.c_str(), PRIMARY_PROFILE_NAME); } int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags, int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags, appid_t appid, const char* seinfo, int target_sdk_version) { appid_t appid, const char* seinfo, int target_sdk_version) { uid_t uid = multiuser_get_uid(userid, appid); uid_t uid = multiuser_get_uid(userid, appid); Loading Loading @@ -105,6 +111,12 @@ int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int PLOG(ERROR) << "Failed to prepare " << profile_path; PLOG(ERROR) << "Failed to prepare " << profile_path; return -1; return -1; } } std::string profile_file = create_primary_profile(profile_path); // read-write only for the app user. if (fs_prepare_file_strict(profile_file.c_str(), 0600, uid, uid) != 0) { PLOG(ERROR) << "Failed to prepare " << profile_path; return -1; } const std::string ref_profile_path = create_data_ref_profile_package_path(pkgname); const std::string ref_profile_path = create_data_ref_profile_package_path(pkgname); // dex2oat/profman runs under the shared app gid and it needs to read/write reference // dex2oat/profman runs under the shared app gid and it needs to read/write reference // profiles. // profiles. Loading Loading @@ -157,12 +169,6 @@ int migrate_app_data(const char *uuid, const char *pkgname, userid_t userid, int return 0; return 0; } } // Keep profile paths in sync with ActivityThread. constexpr const char* PRIMARY_PROFILE_NAME = "primary.prof"; static std::string create_primary_profile(const std::string& profile_dir) { return StringPrintf("%s/%s", profile_dir.c_str(), PRIMARY_PROFILE_NAME); } static bool clear_profile(const std::string& profile) { static bool clear_profile(const std::string& profile) { base::unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC)); base::unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC)); if (ufd.get() < 0) { if (ufd.get() < 0) { Loading Loading
cmds/installd/commands.cpp +12 −6 Original line number Original line Diff line number Diff line Loading @@ -70,6 +70,12 @@ static bool property_get_bool(const char* property_name, bool default_value = fa return strcmp(tmp_property_value, "true") == 0; return strcmp(tmp_property_value, "true") == 0; } } // Keep profile paths in sync with ActivityThread. constexpr const char* PRIMARY_PROFILE_NAME = "primary.prof"; static std::string create_primary_profile(const std::string& profile_dir) { return StringPrintf("%s/%s", profile_dir.c_str(), PRIMARY_PROFILE_NAME); } int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags, int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags, appid_t appid, const char* seinfo, int target_sdk_version) { appid_t appid, const char* seinfo, int target_sdk_version) { uid_t uid = multiuser_get_uid(userid, appid); uid_t uid = multiuser_get_uid(userid, appid); Loading Loading @@ -105,6 +111,12 @@ int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int PLOG(ERROR) << "Failed to prepare " << profile_path; PLOG(ERROR) << "Failed to prepare " << profile_path; return -1; return -1; } } std::string profile_file = create_primary_profile(profile_path); // read-write only for the app user. if (fs_prepare_file_strict(profile_file.c_str(), 0600, uid, uid) != 0) { PLOG(ERROR) << "Failed to prepare " << profile_path; return -1; } const std::string ref_profile_path = create_data_ref_profile_package_path(pkgname); const std::string ref_profile_path = create_data_ref_profile_package_path(pkgname); // dex2oat/profman runs under the shared app gid and it needs to read/write reference // dex2oat/profman runs under the shared app gid and it needs to read/write reference // profiles. // profiles. Loading Loading @@ -157,12 +169,6 @@ int migrate_app_data(const char *uuid, const char *pkgname, userid_t userid, int return 0; return 0; } } // Keep profile paths in sync with ActivityThread. constexpr const char* PRIMARY_PROFILE_NAME = "primary.prof"; static std::string create_primary_profile(const std::string& profile_dir) { return StringPrintf("%s/%s", profile_dir.c_str(), PRIMARY_PROFILE_NAME); } static bool clear_profile(const std::string& profile) { static bool clear_profile(const std::string& profile) { base::unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC)); base::unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC)); if (ufd.get() < 0) { if (ufd.get() < 0) { Loading