Separate GRIL sepolicy for AIDL and HIDL by folders

Related avc error:

aidl part:
avc:  denied  { find } for pid=2019 uid=10269 name=vendor.google.radio_ext.IRadioExt/default scontext=u:r:grilservice_app:s0:c13,c257,c512,c768 tcontext=u:object_r:hal_aidl_radio_ext_service:s0 tclass=service_manager permissive=1

avc:  denied  { read write } for  comm="vendor.google.r" name="umts_boot0" dev="tmpfs" ino=1352 scontext=u:r:hal_aidl_radio_ext:s0 tcontext=u:object_r:radio_device:s0 tclass=chr_file permissive=1

avc:  denied  { search } for  name="backlight" dev="sysfs" ino=83794 scontext=u:r:hal_aidl_radio_ext:s0 tcontext=u:object_r:sysfs_leds:s0 tclass=dir permissive=1

avc:  denied  { read write } for  name="backlight" dev="sysfs" ino=83794 scontext=u:r:hal_aidl_radio_ext:s0 tcontext=u:object_r:sysfs_leds:s0 tclass=file permissive=1

avc:  denied  { read write } for  name="backlight" dev="sysfs" ino=83794 scontext=u:r:hal_aidl_radio_ext:s0 tcontext=u:object_r:sysfs_display:s0 tclass=file permissive=1

avc:  denied  { create } for  name="radio" dev="dm-53" ino=379 scontext=u:r:hal_aidl_radio_ext:s0 tcontext=u:object_r:radio_vendor_data_file:s0 tclass=dir permissive=1

avc:  denied  { create } for  name="radio" dev="dm-53" ino=379 scontext=u:r:hal_aidl_radio_ext:s0 tcontext=u:object_r:radio_vendor_data_file:s0 tclass=file permissive=1

avc:  denied  { find } for interface=hardware.google.bluetooth.bt_channel_avoidance::IBTChannelAvoidance sid=u:r:hal_aidl_radio_ext:s0 pid=792 scontext=u:r:hal_aidl_radio_ext:s0 tcontext=u:object_r:hal_bluetooth_coexistence_hwservice:s0 tclass=hwservice_manager permissive=1

avc:  denied  { find } for interface=hardware.google.bluetooth.bt_channel_avoidance::IBTChannelAvoidance sid=u:r:hal_aidl_radio_ext:s0 pid=792 scontext=u:r:hal_aidl_radio_ext:s0 tcontext=u:object_r:hal_bluetooth_coexistence_service:s0 tclass=service_manager permissive=1


hidl part:
avc:  denied  { read write } for  comm="vendor.google.r" name="umts_boot0" dev="tmpfs" ino=1352 scontext=u:r:hal_radioext_default:s0 tcontext=u:object_r:radio_device:s0 tclass=chr_file permissive=1

avc:  denied  { create } for  name="radio" dev="dm-53" ino=379 scontext=u:r:hal_radioext_default:s0 tcontext=u:object_r:radio_vendor_data_file:s0 tclass=dir permissive=1

avc:  denied  { create } for  name="radio" dev="dm-53" ino=379 scontext=u:r:hal_radioext_default:s0 tcontext=u:object_r:radio_vendor_data_file:s0 tclass=file permissive=1

avc:  denied  { search } for  name="backlight" dev="sysfs" ino=83794 scontext=u:r:hal_radioext_default:s0 tcontext=u:object_r:sysfs_leds:s0 tclass=dir permissive=1

avc:  denied  { read write } for  name="backlight" dev="sysfs" ino=83794 scontext=u:r:hal_radioext_default:s0 tcontext=u:object_r:sysfs_leds:s0 tclass=file permissive=1

avc:  denied  { read write } for  name="backlight" dev="sysfs" ino=83794 scontext=u:r:hal_radioext_default:s0 tcontext=u:object_r:sysfs_display:s0 tclass=file permissive=1

avc:  denied  { find } for interface=hardware.google.bluetooth.bt_channel_avoidance::IBTChannelAvoidance sid=u:r:hal_radioext_default:s0 pid=792 scontext=u:r:hal_radioext_default:s0 tcontext=u:object_r:hal_bluetooth_coexistence_hwservice:s0 tclass=hwservice_manager permissive=1

avc:  denied  { find } for interface=hardware.google.bluetooth.bt_channel_avoidance::IBTChannelAvoidance sid=u:r:hal_radioext_default:s0 pid=792 scontext=u:r:hal_radioext_default:s0 tcontext=u:object_r:hal_bluetooth_coexistence_service:s0 tclass=service_manager permissive=1

Bug: 363665676
Test: verify with test roms
Flag: EXEMPT sepolicy refactor
Change-Id: I0fb75f7f9c7339864ee303c0f1de3b218ceb81ed
This commit is contained in:
Neo Yu 2024-08-19 02:48:41 +08:00
parent c9fb05a230
commit 0ca7adab01
17 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,10 @@
<compatibility-matrix version="1.0" type="framework">
<hal format="aidl" optional="true">
<name>vendor.google.radio_ext</name>
<version>2</version>
<interface>
<name>IRadioExt</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View file

@ -0,0 +1,3 @@
PRODUCT_PACKAGES += vendor.google.radioext@1.0-service
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/gril/aidl/2.0/compatibility_matrix.xml
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/gril/aidl/2.0/sepolicy

View file

@ -0,0 +1 @@
/vendor/bin/hw/vendor\.google\.radioext@1\.0-service u:object_r:hal_aidl_radio_ext_exec:s0

View file

@ -0,0 +1,4 @@
# allow grilservice_app to find hal_aidl_radio_ext_service
allow grilservice_app hal_aidl_radio_ext_service:service_manager find;
binder_call(grilservice_app, hal_aidl_radio_ext)
binder_call(grilservice_app, twoshay)

View file

@ -0,0 +1,33 @@
# hal_aidl_radio_ext domain
type hal_aidl_radio_ext, domain;
type hal_aidl_radio_ext_exec, vendor_file_type, exec_type, file_type;
init_daemon_domain(hal_aidl_radio_ext)
get_prop(hal_aidl_radio_ext, hwservicemanager_prop)
get_prop(hal_aidl_radio_ext, telephony_modemtype_prop)
set_prop(hal_aidl_radio_ext, vendor_gril_prop)
binder_call(hal_aidl_radio_ext, servicemanager)
binder_call(hal_aidl_radio_ext, grilservice_app)
binder_call(hal_aidl_radio_ext, hal_bluetooth_btlinux)
add_service(hal_aidl_radio_ext, hal_aidl_radio_ext_service)
# RW /dev/oem_ipc0
allow hal_aidl_radio_ext radio_device:chr_file rw_file_perms;
# RW MIPI Freq files
allow hal_aidl_radio_ext radio_vendor_data_file:dir create_dir_perms;
allow hal_aidl_radio_ext radio_vendor_data_file:file create_file_perms;
# Bluetooth
allow hal_aidl_radio_ext hal_bluetooth_coexistence_hwservice:hwservice_manager find;
allow hal_aidl_radio_ext hal_bluetooth_coexistence_service:service_manager find;
# Allow access to the backlight driver to set ssc_mode
allow hal_aidl_radio_ext sysfs_leds:dir search;
allow hal_aidl_radio_ext sysfs_leds:file rw_file_perms;
# legacy/zuma/vendor
allow hal_aidl_radio_ext sysfs_display:file rw_file_perms;

View file

@ -0,0 +1,2 @@
# allow hal_camera_default to binder call hal_aidl_radio_ext
binder_call(hal_camera_default, hal_aidl_radio_ext);

View file

@ -0,0 +1,2 @@
# Radio Ext AIDL service
type hal_aidl_radio_ext_service, hal_service_type, protected_service, service_manager_type;

View file

@ -0,0 +1 @@
vendor.google.radio_ext.IRadioExt/default u:object_r:hal_aidl_radio_ext_service:s0

View file

@ -0,0 +1,2 @@
# allow twoshay to binder call hal_aidl_radio_ext
binder_call(twoshay, hal_aidl_radio_ext)

View file

@ -0,0 +1,10 @@
<compatibility-matrix version="1.0" type="framework">
<hal format="hidl" optional="true">
<name>vendor.google.radioext</name>
<version>1.7</version>
<interface>
<name>IRadioExt</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

View file

@ -0,0 +1,3 @@
PRODUCT_PACKAGES += vendor.google.radioext@1.0-service
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/gril/hidl/1.7/compatibility_matrix.xml
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/gril/hidl/1.7/sepolicy

View file

@ -0,0 +1 @@
/vendor/bin/hw/vendor\.google\.radioext@1\.0-service u:object_r:hal_radioext_default_exec:s0

View file

@ -0,0 +1,2 @@
# allow grilservice_app to binder call hal_radioext_default
binder_call(grilservice_app, hal_radioext_default)

View file

@ -0,0 +1,2 @@
# allow hal_camera_default to binder call hal_radioext_default
binder_call(hal_camera_default, hal_radioext_default);

View file

@ -0,0 +1,28 @@
# hal_radioext_default domain
type hal_radioext_default, domain;
type hal_radioext_default_exec, vendor_file_type, exec_type, file_type;
init_daemon_domain(hal_radioext_default)
hwbinder_use(hal_radioext_default)
get_prop(hal_radioext_default, hwservicemanager_prop)
get_prop(hal_radioext_default, telephony_modemtype_prop)
set_prop(hal_radioext_default, vendor_gril_prop)
add_hwservice(hal_radioext_default, hal_radioext_hwservice)
binder_call(hal_radioext_default, servicemanager)
binder_call(hal_radioext_default, grilservice_app)
binder_call(hal_radioext_default, hal_bluetooth_btlinux)
# RW /dev/oem_ipc0
allow hal_radioext_default radio_device:chr_file rw_file_perms;
# RW MIPI Freq files
allow hal_radioext_default radio_vendor_data_file:dir create_dir_perms;
allow hal_radioext_default radio_vendor_data_file:file create_file_perms;
# Bluetooth
allow hal_radioext_default hal_bluetooth_coexistence_hwservice:hwservice_manager find;
allow hal_radioext_default hal_bluetooth_coexistence_service:service_manager find;
# legacy/zuma/vendor
allow hal_radioext_default sysfs_display:file rw_file_perms;

View file

@ -0,0 +1,2 @@
# GRIL HAL
vendor.google.radioext::IRadioExt u:object_r:hal_radioext_hwservice:s0

View file

@ -0,0 +1,2 @@
# allow twoshay to binder call hal_radioext_default
binder_call(twoshay, hal_radioext_default)