Skip to content

Commit 0bee120

Browse files
author
Calin Juravle
committed
Fix sepolicy for secondary dex files
dexoptanalyzer need read access on the secondary dex files and of the main apk files in order to successfully evaluate and optimize them. Example of denial: audit(0.0:30): avc: denied { read } for path="/data/app/~~Zux_isdY0NBkRWPp01oAVg==/com.example.secondaryrepro-wH9zezMSCzIjcKdIMtrw7A==/base.apk" dev="vdc" ino=40966 scontext=u:r:dexoptanalyzer:s0 tcontext=u:object_r:apk_data_file:s0 tclass=file permissive=0 app=com.example.secondaryrepro Test: adb shell cmd package compile -r bg-dexopt --secondary-dex app Bug: 160471235 Bug: 160351055 Merged-In: Id0bda5237d3ce1620d4f6ee89595836b4e1f3abf Change-Id: Id0bda5237d3ce1620d4f6ee89595836b4e1f3abf
1 parent e30b4b6 commit 0bee120

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

prebuilts/api/30.0/private/coredomain.te

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ full_treble_only(`
2222
coredomain
2323
-appdomain
2424
-dex2oat
25+
-dexoptanalyzer
2526
-idmap
2627
-init
2728
-installd
@@ -38,6 +39,7 @@ full_treble_only(`
3839
coredomain
3940
-appdomain
4041
-dex2oat
42+
-dexoptanalyzer
4143
-idmap
4244
-init
4345
-installd

prebuilts/api/30.0/private/dexoptanalyzer.te

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ type dexoptanalyzer, domain, coredomain, mlstrustedsubject;
33
type dexoptanalyzer_exec, system_file_type, exec_type, file_type;
44
type dexoptanalyzer_tmpfs, file_type;
55

6+
r_dir_file(dexoptanalyzer, apk_data_file)
7+
# Access to /vendor/app
8+
r_dir_file(dexoptanalyzer, vendor_app_file)
9+
610
# Reading an APK opens a ZipArchive, which unpack to tmpfs.
711
# Use tmpfs_domain() which will give tmpfs files created by dexoptanalyzer their
812
# own label, which differs from other labels created by other processes.

private/coredomain.te

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ full_treble_only(`
2222
coredomain
2323
-appdomain
2424
-dex2oat
25+
-dexoptanalyzer
2526
-idmap
2627
-init
2728
-installd
@@ -38,6 +39,7 @@ full_treble_only(`
3839
coredomain
3940
-appdomain
4041
-dex2oat
42+
-dexoptanalyzer
4143
-idmap
4244
-init
4345
-installd

private/dexoptanalyzer.te

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ type dexoptanalyzer, domain, coredomain, mlstrustedsubject;
33
type dexoptanalyzer_exec, system_file_type, exec_type, file_type;
44
type dexoptanalyzer_tmpfs, file_type;
55

6+
r_dir_file(dexoptanalyzer, apk_data_file)
7+
# Access to /vendor/app
8+
r_dir_file(dexoptanalyzer, vendor_app_file)
9+
610
# Reading an APK opens a ZipArchive, which unpack to tmpfs.
711
# Use tmpfs_domain() which will give tmpfs files created by dexoptanalyzer their
812
# own label, which differs from other labels created by other processes.

0 commit comments

Comments
 (0)