1172 Commits

Author SHA1 Message Date
Aayush Gupta
e67bb2ceaa non_plat: Label neural networks hidls and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I32d6131cb52ac77aa90e9ac1e73b1ca498ffe5cd
2021-01-25 17:10:58 +05:30
Aayush Gupta
73275bb9c0 non_plat: Label and address dfps hidl/service denials
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I4af35f0ad1cb1f77dae7813341e4d98e0c7b884f
2021-01-25 15:47:16 +05:30
Aayush Gupta
6cf2f424af non_plat: Label and grant required permissions to keinstall hidl/service
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I482e9dd6b42ad62553d1451269eb7ef6c3c3fc3b
2021-01-25 14:22:06 +05:30
Aayush Gupta
ad66e2bf76 non_plat: netd: suppress dir write to /system
Based on: https://review.lineageos.org/c/LineageOS/android_system_sepolicy/+/302134

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ibf9e78f53d79304d70eddd16063bfedae3d0c05f
2021-01-21 10:46:01 +05:30
Aayush Gupta
8d01032f5f Label vtservice binary, hidl, and service and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I2bc48a03416807b9d0403a3a25bd9f7fd5952389
2021-01-19 17:00:18 +05:30
Aayush Gupta
c076d39750 non_plat: Allow proc_perfmgr to associate with proc filesystem
Denial observed without this change:
[    7.887820] .(1)[396:logd.auditd]type=1400 audit(1610975734.228:4): avc: denied { associate } for comm="init" name="boot_boost" scontext=u:object_r:proc_perfmgr:s0 tcontext=u:object_r:proc:s0 tclass=filesystem permissive=1

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I2adca2f377a825840f63643132a064c9c1394b06
2021-01-18 21:47:31 +05:30
Aayush Gupta
92f5e50812 non_plat: Allow epdg_wod rw perms to ccci_device
Denial observed without this change:
[   12.751534] .(4)[396:logd.auditd]type=1400 audit(1610975739.088:638): avc: denied { open } for comm="epdg_wod" path="/dev/ccci_woa" dev="tmpfs" ino=12969 scontext=u:r:epdg_wod:s0 tcontext=u:object_r:ccci_device:s0 tclass=chr_file permissive=1

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I67030c6bd86b5e71442b36c0ee8064d83b5b31ba
2021-01-18 21:44:41 +05:30
Sayali Lokhande
e52cb818b3 non_plat: Allow kernel to search debugfs_mmc dir
Debugfs is failed to be initialized because of the denial below.
Add selinux policy to fix it.
avc: denied { search } for comm="kworker/0:1" name="mmc0"
dev="debugfs" ino=6562 scontext=u:r:kernel:s0
tcontext=u:object_r:debugfs_mmc:s0 tclass=dir permissive=0

CRs-Fixed: 2636489
Change-Id: I831a363d448b3efe11960c3937b04dbca80d37f3
2021-01-18 21:42:58 +05:30
Aayush Gupta
09030d80bd non_plat: Allow mtk_agpsd to manage wakelocks
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I4d1b85254cd2dedcd275d5e7c0bcd9942d2e2ae4
2021-01-18 20:55:32 +05:30
Aayush Gupta
df5aa45ca7 non_plat: Label ipsec binary and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ia0f872f152f0a651a8954aec8372b363963e0c6d
2021-01-18 20:55:27 +05:30
Aayush Gupta
84ae870bb8 non_plat: Label and address stroke binary denials
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I65a085ae9023f9788f780f28246b5297d1682c6e
2021-01-18 19:00:40 +05:30
Aayush Gupta
3525f7a751 non_plat: Label /dev/socket/volte_imsvt1 and allow mtkimsapdomain write to it
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ice16c7115b1b8ffce3ebfe76074706e0fda3c50f
2021-01-03 10:58:52 +05:30
Aayush Gupta
084a15e4f3 non_plat: Allow tee to connect to init unix_stream_socket
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I34faff63cef2042bcc9eeb791cc33a5439ba20ca
2021-01-03 10:56:00 +05:30
Aayush Gupta
91547390a8 non_plat: Label /dev/teei_config and allow tee rw permissions to it
Denials observed without this change:
    7.811050] .(2)[398:logd.auditd]type=1400 audit(1609581532.144:5): avc: denied { read write } for comm="teei_daemon" name="teei_config" dev="tmpfs" ino=3600 scontext=u:r:tee:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1
[    7.813712] .(2)[398:logd.auditd]type=1400 audit(1609581532.144:6): avc: denied { open } for comm="teei_daemon" path="/dev/teei_config" dev="tmpfs" ino=3600 scontext=u:r:tee:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1
[    7.816434] .(2)[398:logd.auditd]type=1400 audit(1609581532.144:6): avc: denied { open } for comm="teei_daemon" path="/dev/teei_config" dev="tmpfs" ino=3600 scontext=u:r:tee:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1
[    7.819089] .(2)[398:logd.auditd]type=1400 audit(1609581532.144:7): avc: denied { ioctl } for comm="teei_daemon" path="/dev/teei_config" dev="tmpfs" ino=3600 ioctlcmd=0x5403 scontext=u:r:tee:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1

Test: Boot and notice that denials no longer appears

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ia779816cbf9312b50a5f5101f7935f1a83b210f2
2021-01-03 10:56:00 +05:30
Aayush Gupta
a20c39e9f3 non_plat: Label and grant required permissions to VPU devices
- SELinux rules have been decompiled from stock ROM's sepolicy

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ia5b712f2c2f77aa363499788d1201b29f232311e
2021-01-03 10:56:00 +05:30
Aayush Gupta
e4a9991131 non_plat: Label xcap binary and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I127160acbcffcee0c055f7a78d62acc37741d2cf
2021-01-03 10:56:00 +05:30
Aayush Gupta
a7d6f83b00 non_plat: Label wfca binary and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I22832543e458ad1e3cc597911b8af347c92ccda5
2021-01-03 10:56:00 +05:30
Aayush Gupta
965100d2a9 non_plat: Label epdg_wod and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I87460bad635dd0e7dbbb8790457f5d23f8a87a97
2021-01-03 10:56:00 +05:30
Aayush Gupta
c7b5ec1463 non_plat: Grant netd required permissions for mtkimsapdomain
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I75f81955f5c56d776b3fbf1c1796e9d659cb3d5a
2021-01-03 10:56:00 +05:30
Aayush Gupta
c4bd4e850c non_plat: Label volte_stack binary and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I1ff3478844f876405a378f19ecd095daf7629708
2021-01-03 10:56:00 +05:30
Aayush Gupta
23c3e00542 non_plat: Label volte_ua binary and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I3681ff0ed7a1de2499b8d53fd5d355cacff3a33a
2021-01-03 10:55:55 +05:30
Aayush Gupta
c07ec24c97 non_plat: Label bip binary and grant required permissions
- SELinux rules are obtained fro stock SEpolicy

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ie262a1a2a93aabc1cfa6e1cbdadf647058caec31
2021-01-03 10:08:25 +05:30
Aayush Gupta
a76a7cc1d2 non_plat: Label volte_ism_93 and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I2ca62b8caed4c7b9e6994e4705df492028ed148d
2021-01-03 10:07:32 +05:30
Aayush Gupta
1e1ffa249d non_plat: Label volte_md_status and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ia41f71d07852bcb357cc26c0cb82d67c53cf19e9
2021-01-03 10:06:17 +05:30
Aayush Gupta
9ef4675f68 non_plat: Allow all domains to search debugfs_ion dir
[   12.536452] .(1)[399:logd.auditd]type=1400 audit(1262323310.848:231): avc: denied { search } for comm="audio@5.0-servi" name="clients" dev="debugfs" ino=3111 scontext=u:r:mtk_hal_audio:s0 tcontext=u:object_r:debugfs_ion:s0 tclass=dir permissive=1
[   59.661176] .(0)[399:logd.auditd]type=1400 audit(1609417550.280:331): avc: denied { search } for comm="RenderThread" name="clients" dev="debugfs" ino=3111 scontext=u:r:system_app:s0 tcontext=u:object_r:debugfs_ion:s0 tclass=dir permissive=1
[   50.275600] .(4)[399:logd.auditd]type=1400 audit(1609417547.748:325): avc: denied { search } for comm="RenderThread" name="clients" dev="debugfs" ino=3111 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:debugfs_ion:s0 tclass=dir permissive=1 app=com.android.launcher3

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ib8c7e944e95851d5ceef42bb3ea88c77c3cc7e0b
2021-01-03 10:04:01 +05:30
Aayush Gupta
066c480209 non_plat: Allow tee to write property_socket's sock_file
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ic45a915de2246db6d2746aa5970ae55012987d5e
2021-01-03 10:03:20 +05:30
Aayush Gupta
901eb61127 non_plat: Label ipsec_mon binary and grant required permissions
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I0bb583b380590ef753fbdd949e92a34f505b6ce1
2020-12-31 23:28:10 +05:30
Aayush Gupta
0f6aa91846 non_plat: Allow mtk_hal_wifi to set wifi version property
Denial observed without this change:
[   19.217624] .(3)[351:init]selinux: avc:  denied  { set } for property=vendor.wlan.firmware.version pid=1389 uid=1010 gid=1010 scontext=u:r:mtk_hal_wifi:s0 tcontext=u:object_r:vendor_wifi_version:s0 tclass=property_service permissive=1\x0a

Test: Boot and notice denial no longer appears

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Id769a2012ff7c53320e8d7a44bc2f49230e2a0e9
2020-12-31 23:01:22 +05:30
Aayush Gupta
22380a4614 non_plat: Label /dev/tee* and grant required perms to domains
/dev/tee* are accessed by domains that interact with TEE and thus
require access to them too.

Test: Boot and observe that denials are not visible in logs anymore

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I7b0944a1063da8561d2928e4110674ce4845ecea
2020-12-30 17:00:34 +05:30
Aayush Gupta
2e08559c2b non_plat: Label /data/vendor/thh and allow tee to manage it
TEE stores its file in /data/vendor/thh/. Allow it required permissions
to do so.

Denials observed without this change:
12-28 16:42:11.556   416   416 I teei_daemon: type=1400 audit(0.0:394): avc: denied { open } for path="/data/vendor/thh/7778c03fc30c4dd0a319ea29643d4d4b." dev="sdc46" ino=2490455 scontext=u:r:tee:s0 tcontext=u:object_r:vendor_data_file:s0 tclass=dir permissive=1

Test: Boot and notice that denials have resolved

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I1a608ebac628c8ce9c35ece1566e049236321a4b
2020-12-30 16:19:22 +05:30
Aayush Gupta
174dc137d1 non_plat: Label /dev/tz_vfs and grant required perms to tee
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I6bb5d9e3f8f3047bfe8285f25b53adadb8b1c1ac
2020-12-30 16:18:38 +05:30
Aayush Gupta
acd62758d9 non_plat: Label /dev/*rpmb* and grant tee permissions to manage it
/dev/*rpmb* devices are accessed by tee. Label it and allow tee required
permissions to manage it.

Denial observed without this change:
[   46.559953] .(2)[399:logd.auditd]type=1400 audit(1609128921.644:391): avc: denied { ioctl } for comm="teei_daemon" path="/dev/rpmb0" dev="tmpfs" ino=17454 ioctlcmd=0x6 scontext=u:r:init:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1

Test: Boot and observe that denial no longer appears

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I3499e2a3ba177b8e69d8cdbb76939daf3f8bbc7b
2020-12-30 16:18:06 +05:30
Aayush Gupta
03fc01b6f6 non_plat: Label tee_{daemon|loader} as tee_exec
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ibf3ace0d64a18d404d01230ad919af1e27c4e123
2020-12-30 16:16:25 +05:30
Aayush Gupta
5c601a9ada non_plat: Label /dev/ut_keymaster and allow relevant permissions to sources
/dev/ut_keymaster is used by keymaster. Label it and allow relevant permissions
which domains using it (vold, tee and keymaster) requires.

Denial observed without this change:
[   46.666247] .(2)[399:logd.auditd]type=1400 audit(1609128921.744:392): avc: denied { ioctl } for comm="keymaster@3.0-s" path="/dev/ut_keymaster" dev="tmpfs" ino=17464 ioctlcmd=0x5402 scontext=u:r:hal_keymaster_default:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1

Test: Boot and notice that denial no longer appears

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Iee0126d637a139397db8857d8a780277c3ea4576
2020-12-30 16:14:46 +05:30
Aayush Gupta
a15f249346 non_plat: Label /dev/teei_fp and allow required perms to hal_fingerprint_default
/dev/teei_fp is used by fingerprint to communicate with Microtrust TEE drivers to
store fingerprint data on the device. Label it and allow relevant source required
permissions.

Denial observed without this change:
[   17.672144] .(4)[397:logd.auditd]type=1400 audit(1608975801.860:326): avc: denied { ioctl } for comm="fingerprint@2.1" path="/dev/teei_fp" dev="tmpfs" ino=15742 ioctlcmd=0x5402 scontext=u:r:hal_fingerprint_default:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1

Test: Boot and notice denials have disappeared

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I8a7445400be241e81f8bf21347967b85381ed3ec
2020-12-30 16:14:31 +05:30
Aayush Gupta
54f06d5d7c non_plat: Label thermal binary and grant required perms
Thermal binary is used to load, throttle, manage thermal profiles on MediaTek devices.
Label it and grant required permissions for it to operate without any issues.

Test: Boot and notice thermal has now a proper domain and works without an issues

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: Ibbc7e0ce907cd5eedd7826c658e7ef9c2d7a907d
2020-12-30 10:18:16 +05:30
Aayush Gupta
c0c34708a5 non_plat: Generate sysfs_net context for /devices/platform/CONNAC
CONNAC is MediaTek's Connectivity Combo Chip Driver, generate sysfs_net
context for it

Denial observed without this change:
[   59.165685] .(2)[399:logd.auditd]type=1400 audit(1609128934.244:404): avc: denied { open } for comm="Binder:4098_1" path="/sys/devices/platform/CONNAC/net/wlan0/address" dev="sysfs" ino=43157 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1 app=com.google.android.gms

Test: Boot and notice that path now has a proper context

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I0c76124e953b80d06714340ab4413eee84e6f2ef
2020-12-30 10:14:20 +05:30
Aayush Gupta
0e29840d66 non_plat: Allow mtk_hal_camera rw perms for seinf device
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I4fe395de1e4c392d1f89a5976d3639fea3b7daab
2020-12-30 10:11:35 +05:30
Aayush Gupta
7a0a7ea6a5 non_plat: Label /data/vendor/camera/ and allow mtk_hal_camera create perms
Camera data files are store in /data/vendor/camera/ by camera hal on
treble devices. Label and allow mtk_hal_camera to manage it.

Denial observed without this change:
[   17.686535] .(4)[399:logd.auditd]type=1400 audit(1609114842.280:303): avc: denied { getattr } for comm="camerahalserver" path="/data/vendor/camera/back_dual_camera_caldata_wt.bin" dev="sdc46" ino=2490446 scontext=u:r:mtk_hal_camera:s0 tcontext=u:object_r:vendor_data_file:s0 tclass=file permissive=1

Test: Boot and notice denial has disappeared

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I98d0ddcce95cccdb9e86c4d36cb692e1f1ff41cb
2020-12-30 10:10:31 +05:30
Aayush Gupta
590a77d53d non_plat: Allow vold to manage sysfs_mmcblk device
During init, vold needs rw permissions in order to manage block devices.
This change allows the required permissions.

Denial observed without this change:
[    7.574441] .(1)[397:logd.auditd]type=1400 audit(1608975791.836:9): avc: denied { write } for comm="Binder:379_2" name="uevent" dev="sysfs" ino=35884 scontext=u:r:vold:s0 tcontext=u:object_r:sysfs_mmcblk:s0 tclass=file permissive=1

Test: Boot and observe that denial has disappeared

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I3fa256cf5957f0af3fa2628833820f0f9fcf298b
2020-12-28 00:45:07 +05:30
Aayush Gupta
1957ab0ba8 non_plat: Allow vendor_init to set mtk_dsbp_support_prop
DSBP property is set by multiple mediatek devices to declare support
for the same. It is already labeled in property_contexts but seems to
missing permission for vendor_init to actually set it.

Denial observed without this change:
[    4.713173] .(7)[1:init]selinux: avc:  denied  { set } for property=persist.vendor.radio.mtk_dsbp_support pid=1 uid=0 gid=0 scontext=u:r:vendor_init:s0 tcontext=u:object_r:mtk_dsbp_support_prop:s0 tclass=property_service permissive=1\x0a

Test: Boot and observe that propery is set without any denial

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I0cc0c2cadbf9edb3fb205b9e52074f852fe08658
2020-12-28 00:39:58 +05:30
Aayush Gupta
9a3e56224e non_plat: Introduce new label for setting mtk specific camera properties
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I1ce016d9e3a9cb7cda1170c830c7edd327528610
2020-12-28 00:39:45 +05:30
Vinay Gannevaram
b8d409439e sepolicy : Add rule to set property for wlan driver/fw ver info
wlan driver/fw version are set at property at enforcing mode.
Add rules to allow to set wlan driver/fw version info

CRs-Fixed: 2460816
Change-Id: Ic0bb570cd53fe450512496c5864f432ce3219bbe
2020-12-26 16:28:02 +05:30
Aayush Gupta
249759bf00 mediatek: Inherit lineage sepcific mediatek sepolicy
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I9918ae0ce11bb41a6081d3137591d3626d337a74
2020-12-24 16:56:51 +05:30
Aayush Gupta
9029a49cc4 plat_private: Use newline at the end of service_contexts
Missing newline causes compile-time error when sepolicy squashes all given
service-contexts into single file to pack into the build. This change
fixes that issue.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2020-12-21 22:01:18 +05:30
Aayush Gupta
4fbc9434e9 non_plat: Remove duplicate sepolicy rules
These types are already defined in system/sepolicy and gives compile-time
errors. Remove them to resolve the issues.

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
2020-12-21 22:01:08 +05:30
Shanshan Guo
5da546820c [ALPS04968083] SEPolicy: Modify sepolicy files mode and type
[Detail]
The mode of sepolicy files should be -rw-r--r--,
and the type should be ASCII text with Unix/Linux format.

[Solution]
1.Use chmod 0644 to change sepolicy files mode.
2.Use iconv -t ASCII and dos2unix to change sepolicy files
  type and format.

MTK-Commit-Id: ee386fd7ca89105f70b96f6b58c5f0e372fe9a4b

Change-Id: Iac13b1ea8a4546168f68a7918acdcdb0588f6630
CR-Id: ALPS04968083
Feature: [Android Default] SELinux, SEAndroid, and SE-MTK
2020-12-21 22:01:08 +05:30
Shanshan Guo
2b923a53d6 [ALPS05009976] SEPolicy: Merge folder non_plat and r_non_plat
[Detail]
BASIC and BSP project should have same sepolicies in basic/.

[Solution]
1.Modify SEPolicies in non_plat/ by comparing with r_non_plat/ .
2.Remove r_non_plat/ .

Change-Id: I24d3df00255779bd73f4075c1c4062176d5b6047
CR-Id: ALPS05009976
Feature: [Android Default] SELinux, SEAndroid, and SE-MTK
2020-12-21 12:06:48 +05:30
Juju Sung
d9354577e0 [ALPS04971420] Update drm service executables file_contexts
regexp to better support mulitple variant context

Bug: 139134043
Test: DeviceManifest/SingleManifestTest.InterfacesAreReleased
Test: MediaDrmClearkeyTest
Change-Id: Iba8cbb5570b0731746857ba9f9ac578e2c95e450
CR-Id: ALPS04971420
Feature: [Android Default] SELinux, SEAndroid, and SE-MTK
2020-12-21 12:00:53 +05:30
Huaiming Li
72c36f94b4 [ALPS04975618] fix dumpstate xTS fail
1. mnt_expand_file no getattr selinux rule

Change-Id: I14a31e6b4f778270ae1a684a5c1ea1407f4d6786
CR-Id: ALPS04975618
Feature: Android Exception Engine(AEE)
2020-12-21 11:26:39 +05:30