OSDN Git Service

Set a default ACL on /data/media/userId.
authorMartijn Coenen <maco@google.com>
Mon, 1 Feb 2021 07:57:02 +0000 (07:57 +0000)
committerMartijn Coenen <maco@google.com>
Wed, 24 Feb 2021 11:45:09 +0000 (12:45 +0100)
commit5adf92a988bef0557f6b60cecaa3924c2667079e
treed21dcf6b7b457bde4e0df27bbfdb227214ac17ea
parenta98846d8d5bd186f5d76530edab96afa99ca952d
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: Ic5d63457ec917ea407b900dbb7773d89311780c6
FsCrypt.cpp
Utils.cpp
Utils.h