Skip to content

Commit

Permalink
Merge "Revert "Revert "Revert "Set a default ACL on /data/media/userI…
Browse files Browse the repository at this point in the history
…d.""""
  • Loading branch information
Dhiraj Jadhav authored and Gerrit Code Review committed Feb 18, 2021
2 parents 810bcca + 72005fd commit a98846d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
11 changes: 1 addition & 10 deletions FsCrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ using android::vold::KeyBuffer;
using android::vold::KeyGeneration;
using android::vold::retrieveKey;
using android::vold::retrieveOrGenerateKey;
using android::vold::SetDefaultAcl;
using android::vold::SetQuotaInherit;
using android::vold::SetQuotaProjectId;
using android::vold::writeStringToFile;
Expand Down Expand Up @@ -863,15 +862,7 @@ bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_
if (!prepare_dir(misc_ce_path, 01771, AID_SYSTEM, AID_MISC)) return false;
if (!prepare_dir(vendor_ce_path, 0771, AID_ROOT, AID_ROOT)) return false;
}
if (!prepare_dir(media_ce_path, 02770, AID_MEDIA_RW, AID_MEDIA_RW)) return false;
// On devices without sdcardfs (kernel 5.4+), the path permissions aren't fixed
// up automatically; therefore, use a default ACL, to ensure apps with MEDIA_RW
// can keep reading external storage; in particular, this allows app cloning
// scenarios to work correctly on such devices.
int ret = SetDefaultAcl(media_ce_path, 02770, AID_MEDIA_RW, AID_MEDIA_RW, {AID_MEDIA_RW});
if (ret != android::OK) {
return false;
}
if (!prepare_dir(media_ce_path, 0770, AID_MEDIA_RW, AID_MEDIA_RW)) return false;

if (!prepare_dir(user_ce_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false;

Expand Down
4 changes: 2 additions & 2 deletions Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ status_t DestroyDeviceNode(const std::string& path) {
}

// Sets a default ACL on the directory.
status_t SetDefaultAcl(const std::string& path, mode_t mode, uid_t uid, gid_t gid,
std::vector<gid_t> additionalGids) {
int SetDefaultAcl(const std::string& path, mode_t mode, uid_t uid, gid_t gid,
std::vector<gid_t> additionalGids) {
if (IsSdcardfsUsed()) {
// sdcardfs magically takes care of this
return OK;
Expand Down
3 changes: 0 additions & 3 deletions Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ std::string GetFuseMountPathForUser(userid_t user_id, const std::string& relativ
status_t CreateDeviceNode(const std::string& path, dev_t dev);
status_t DestroyDeviceNode(const std::string& path);

status_t SetDefaultAcl(const std::string& path, mode_t mode, uid_t uid, gid_t gid,
std::vector<gid_t> additionalGids);

status_t AbortFuseConnections();

int SetQuotaInherit(const std::string& path);
Expand Down

0 comments on commit a98846d

Please sign in to comment.