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, 23 Dec 2020 21:05:02 +0000 (21:05 +0000)
commita71323ec0ea0927464c7e6f62770ef43f649b3fb
treebee7d6f5f29fd9787d26cd5a3c24aef0dcd80780
parent94d6c1275df9f87ead4ab56a43f3b0612d0178af
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: Ib718b8362df84754ee3cac33865bca3c12df2e3a
FsCrypt.cpp
Utils.cpp
Utils.h