From 1a2dbd917e8b2f178915cd50c39fc670f9fca6d4 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Mon, 25 Apr 2022 09:41:33 +0900 Subject: [PATCH] Remove stale files in /data/misc/virtualizationservice [1] changed the UID of the virtualizationservice daemon and /data/misc/virtualizationservice directory to `system`. However, this can cause a permission denial issue when the directory has stale files when the device was running a build before [1] and an OTA to [1] (or above) is attempted. The daemon tries to delete the stale files - which must have been still labeled as old UID and thus the daemon has no privileged to delete them. Fixing this issue by ensuring that the directory is always empty by init. [1] https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2059527 Bug: 230056726 Test: watch TH Merged-In: I61c0297503347932b14b83859bec9ff82628336f Change-Id: I61c0297503347932b14b83859bec9ff82628336f --- rootdir/init.rc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rootdir/init.rc b/rootdir/init.rc index d39a21ca1..aae28dc21 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -828,7 +828,10 @@ on post-fs-data # directory used for odsign metrics mkdir /data/misc/odsign/metrics 0770 root system - # Directory for VirtualizationService temporary image files. + # Directory for VirtualizationService temporary image files. Always create + # a fresh new empty directory to remove any stale files from the previous + # boot. + rmdir /data/misc/virtualizationservice mkdir /data/misc/virtualizationservice 0700 system system mkdir /data/preloads 0775 system system encryption=None