OSDN Git Service

Set a default ACL on /data/media/userId.
authorMartijn Coenen <maco@google.com>
Wed, 16 Dec 2020 08:40:33 +0000 (09:40 +0100)
committerMartijn Coenen <maco@google.com>
Wed, 16 Dec 2020 16:54:22 +0000 (17:54 +0100)
commit8688eb4f47bd589feb2e885836b34c5991158845
tree042212ad5cd6c71412b79d0e86d577a625356c94
parent23bfcbb6be5afd1689f55837a8cbebeed4c7a6c3
Set a default ACL on /data/media/userId.

This directory is used as a root for external storage on adopted storage
devices. It needs to be writable by processes holding the AID_MEDIA_RW
GID permission; in particular, it should be writable by the FUSE daemon.

On devices with sdcardfs, this was ensured automatically, because
sdcardfs presented a view of this directory that was writable, that we
could use for the FUSE daemon. But on devices without sdcardfs, the FUSE
daemon sees the raw filesystem and its permissions. This also means that
files created by the FUSE daemon will have their uid/gid set to the uid
of the FUSE daemon; to ensure these files stay writable to other system
applications that have AID_MEDIA_RW, use a default ACL to make sure the
gid stays AID_MEDIA_RW.

In particular, this fixes an issue with app cloning, where we want the
FUSE daemon of user 0 to be able to access the files of the app clone
user, and vice versa.

Bug: 154057120
Test: inspect uid/gid of /data/media/0 and contents
Change-Id: I6dfae41f9cb6a8283978b2667b02708a000f07c0
FsCrypt.cpp
Utils.cpp
Utils.h