gps: add sepolicy

- Add sepolicy for vendor gnss binary
 - Add sepolicy for gnss_check.sh

Bug: 294708565
Bug: 301509452

Test: GPS Test, check avc denied errors
Change-Id: Idc78f44641b063a37c91f9a3c12fe255e8d2d078
This commit is contained in:
Joe Huang 2023-08-25 04:32:35 +08:00
parent 691b1384c6
commit c2a9fb71dc
12 changed files with 64 additions and 0 deletions

View file

@ -3,3 +3,6 @@ BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/caiman
# UDFPS sepolicy.
BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/fingerprint
# GPS sepolicy
BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/gnss

11
gnss/file_contexts Normal file
View file

@ -0,0 +1,11 @@
# GPS
/dev/gnss_ipc u:object_r:vendor_gnss_device:s0
/dev/gnss_boot u:object_r:vendor_gnss_device:s0
/dev/gnss_dump u:object_r:vendor_gnss_device:s0
/vendor/bin/hw/gnssd u:object_r:gnssd_exec:s0
/vendor/bin/hw/sctd u:object_r:sctd_exec:s0
/vendor/bin/hw/swcnd u:object_r:swcnd_exec:s0
/vendor/bin/hw/spad u:object_r:spad_exec:s0
/vendor/bin/hw/gnss-aidl-service_IGnssV2_ISlsiGnssV1 u:object_r:hal_gnss_default_exec:s0
/vendor/bin/gnss_check\.sh u:object_r:gnss_check_exec:s0

6
gnss/gnss_check.te Normal file
View file

@ -0,0 +1,6 @@
type gnss_check, domain;
type gnss_check_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(gnss_check);
allow gnss_check vendor_toolbox_exec:file { execute_no_trans };

23
gnss/gnssd.te Normal file
View file

@ -0,0 +1,23 @@
type gnssd, domain;
type gnssd_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(gnssd);
# Allow gnssd to access rild
binder_call(gnssd, rild);
# binder_call(gnssd, hwservicemanager)
allow gnssd hal_exynos_rild_hwservice:hwservice_manager find;
allow gnssd radio_device:chr_file rw_file_perms;
# Allow gnssd to acess gnss device
allow gnssd vendor_gnss_device:chr_file rw_file_perms;
allow gnssd vendor_gps_file:dir create_dir_perms;
allow gnssd vendor_gps_file:file create_file_perms;
allow gnssd vendor_gps_file:fifo_file create_file_perms;
get_prop(gnssd, bootanim_system_prop)
# Allow gnssd to obtain wakelock
wakelock_use(gnssd)
# Allow a base set of permissions required for network access.
net_domain(gnssd);

2
gnss/hal_gnss_default.te Normal file
View file

@ -0,0 +1,2 @@
binder_call(hal_gnss_default, gnssd);

1
gnss/rild.te Normal file
View file

@ -0,0 +1 @@
binder_call(rild, gnssd)

3
gnss/sctd.te Normal file
View file

@ -0,0 +1,3 @@
type sctd, domain;
type sctd_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(sctd);

3
gnss/spad.te Normal file
View file

@ -0,0 +1,3 @@
type spad, domain;
type spad_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(spad);

3
gnss/swcnd.te Normal file
View file

@ -0,0 +1,3 @@
type swcnd, domain;
type swcnd_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(swcnd);

View file

@ -3,3 +3,6 @@ BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/komodo
# UDFPS sepolicy.
BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/fingerprint
# GPS sepolicy
BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/gnss

View file

@ -3,3 +3,6 @@ BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/ripcurrent24
# UDFPS sepolicy.
BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/fingerprint
# GPS sepolicy
BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/gnss

View file

@ -3,3 +3,6 @@ BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/tokay
# UDFPS sepolicy.
BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/fingerprint
# GPS sepolicy
BOARD_SEPOLICY_DIRS += device/google/caimito-sepolicy/gnss