fbe業務流程分析2-data/media掛載
阿新 • • 發佈:2020-12-05
設定鎖屏密碼後開機的日誌如下: 07-11 10:33:58.367 966 1338 I ActivityManager: Force stopping com.android.providers.media appid=10019 user=-1: vold reset // vold reset 07-11 10:33:58.374 583 583 V vold : Waiting for FUSE to spin up... // emulatedVolume執行doMount()。fork子程序sdcardd掛載/data/media內部儲存。ls命令檢視檔名是已加密。但是隻有使用者輸入憑證後如下目錄才可用: /sdcard -> /storage/self/primary /storage/self/primary -> /mnt/user/0/primary 符號檔案sdcard和/storage/self/primary已經建立,但是 /mnt/user/0/primary檔案需要在onUserStarted()函式裡才能建立。 當用戶輸入憑證後,上層呼叫e4crypt_unlock_user_key,設定user 0 CE key。 接著上層呼叫VoldNativeService::onUserStarted()啟動使用者。 onUserStarted()函式列印如下log:Linking /storage/emulated/0 to /mnt/user/0/primary 07-11 10:41:53.308 583 583 D vold : e4crypt_unlock_user_key 0 serial=0 token_present=0 07-11 10:41:53.313 583 583 D vold : Skipping non-key . 07-11 10:41:53.313 583 583 D vold : Skipping non-key .. 07-11 10:41:53.313 583 583 D vold : Trying user CE key /data/misc/vold/user_keys/ce/0/current 07-11 10:41:53.319 583 583 D vold : Successfully retrieved key 07-11 10:41:53.323 583 583 D vold : Added key 253940536 (ext4:ac0d2711774f4153) to keyring 339867308 in process 583 07-11 10:41:53.324 583 583 D vold : Added key 572839207 (f2fs:ac0d2711774f4153) to keyring 339867308 in process 583 07-11 10:41:53.324 583 583 D vold : Added key 171258648 (fscrypt:ac0d2711774f4153) to keyring 339867308 in process 583 07-11 10:41:53.324 583 583 D vold : Installed ce key for user 0 07-11 10:41:53.326 583 583 D vold : e4crypt_prepare_user_storage for volume null, user 0, serial 0, flags 2 07-11 10:41:53.326 583 583 D vold : Preparing: /data/system_ce/0 07-11 10:41:53.326 583 583 D vold : Preparing: /data/misc_ce/0 07-11 10:41:53.326 583 583 D vold : Preparing: /data/vendor_ce/0 07-11 10:41:53.327 583 583 D vold : Preparing: /data/media/0 07-11 10:41:53.328 583 583 D vold : Preparing: /data/data 07-11 10:41:53.328 583 583 I vold : Found policy ac0d2711774f4153 at /data/system_ce/0 which matches expected value 07-11 10:41:53.328 583 583 I vold : Found policy ac0d2711774f4153 at /data/misc_ce/0 which matches expected value 07-11 10:41:53.328 583 583 I vold : Policy for /data/vendor_ce/0 set to ac0d2711774f4153 modes 127/4 07-11 10:41:53.329 583 583 I vold : Found policy ac0d2711774f4153 at /data/media/0 which matches expected value 07-11 10:41:53.329 583 583 I vold : Found policy ac0d2711774f4153 at /data/data which matches expected value 07-11 10:41:53.329 583 583 V vold : Starting restorecon of /data/system_ce/0 07-11 10:41:53.335 583 583 V vold : Finished restorecon of /data/system_ce/0 07-11 10:41:53.335 583 583 V vold : Starting restorecon of /data/misc_ce/0 07-11 10:41:53.340 583 583 V vold : Finished restorecon of /data/misc_ce/0 07-11 10:41:53.340 583 583 V vold : /system/bin/vold_prepare_subdirs 07-11 10:41:53.340 583 583 V vold : prepare 07-11 10:41:53.340 583 583 V vold : 07-11 10:41:53.340 583 583 V vold : 0 07-11 10:41:53.340 583 583 V vold : 2 07-11 10:41:53.373 3240 3240 D vold_prepare_subdirs: Setting up mode 700 uid 0 gid 0 context u:object_r:vold_data_file:s0 on path: /data/misc_ce/0/vold 07-11 10:41:53.375 3240 3240 D vold_prepare_subdirs: Setting up mode 700 uid 0 gid 0 context u:object_r:storaged_data_file:s0 on path: /data/misc_ce/0/storaged 07-11 10:41:53.376 583 583 I vold_prepare_subdirs: SELinux: Loaded file_contexts 07-11 10:41:53.609 583 583 D vold : Linking /storage/emulated/0 to /mnt/user/0/primary