common: Add macloader
authorAndreas Schneider <asn@cryptomilk.org>
Mon, 16 Mar 2020 17:23:06 +0000 (18:23 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 1 Apr 2020 05:43:22 +0000 (07:43 +0200)
Change-Id: I07916e20a98c3836099e1ea8124537d7b05138b2

common/vendor/file.te
common/vendor/file_contexts
common/vendor/genfs_contexts
common/vendor/macloader.te [new file with mode: 0644]

index c3c562af0eeab652ff20f782ebc193d21037b38d..a1c4b23506d88d8705eb92ec582e81fadd74565c 100644 (file)
@@ -1,4 +1,11 @@
 # file.te
 
+### DATA
+type conn_vendor_data_file, file_type, data_file_type;
+type wifi_vendor_data_file, file_type, data_file_type;
+
 ### SYSFS
+type sysfs_wifi, sysfs_type, r_fs_type, fs_type;
+
 type sysfs_backlight_writable, sysfs_type, rw_fs_type, fs_type;
+type sysfs_wifi_writable, sysfs_type, rw_fs_type, fs_type;
index f680d56a399d372286d317267a67e701d218e5dd..b9df7248df35cddd6306b722f83e8a45dde11714 100644 (file)
@@ -1,5 +1,9 @@
 # file_contexts
 
+### DATA
+/data/vendor/conn(/.*)?                      u:object_r:conn_vendor_data_file:s0
+/data/vendor/wifi(/.*)?                      u:object_r:wifi_vendor_data_file:s0
+
 ### VENDOR
 /(vendor|system/vendor)/bin/hw/android\.hardware\.light@[0-9].[0-9]-service\.samsung              u:object_r:hal_light_default_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.power@[0-9].[0-9]-service\.exynos               u:object_r:hal_power_default_exec:s0
index 29d6330623d3881249ba85c426f5e823738f2785..a530de56ef25d81383b7e734300f4ce67058135b 100644 (file)
@@ -9,3 +9,10 @@ genfscon sysfs /devices/platform/panel@0/backlight/panel/max_brightness   u:obje
 genfscon sysfs /devices/virtual/timed_output/vibrator/intensity           u:object_r:sysfs_vibrator:s0
 genfscon sysfs /devices/virtual/timed_output/vibrator/multi_freq          u:object_r:sysfs_vibrator:s0
 genfscon sysfs /devices/virtual/timed_output/vibrator/cp_trigger_index    u:object_r:sysfs_vibrator:s0
+
+genfscon sysfs /module/dhd/parameters                                     u:object_r:sysfs_wifi_writable:s0
+
+genfscon sysfs /wifi                                                      u:object_r:sysfs_wifi:s0
+genfscon sysfs /wifi/cid                                                  u:object_r:sysfs_wifi_writable:s0
+genfscon sysfs /wifi/mac_addr                                             u:object_r:sysfs_wifi_writable:s0
+genfscon sysfs /wifi/memdump                                              u:object_r:sysfs_wifi_writable:s0
diff --git a/common/vendor/macloader.te b/common/vendor/macloader.te
new file mode 100644 (file)
index 0000000..f82a987
--- /dev/null
@@ -0,0 +1,28 @@
+# macloader.te
+
+type macloader, domain;
+type macloader_exec, exec_type, vendor_file_type, file_type;
+
+# macloader is started by init, type transit from init domain to macloader domain
+init_daemon_domain(macloader)
+
+allow macloader self:capability { net_admin };
+
+allow macloader self:udp_socket create_socket_perms;
+allowxperm macloader self:udp_socket ioctl { 0x8913 0x8914 };
+
+# /data/vendor/conn
+allow macloader conn_vendor_data_file:dir rw_dir_perms;
+allow macloader conn_vendor_data_file:file create_file_perms;
+
+# /sys/class/net
+allow macloader sysfs_net:dir r_dir_perms;
+allow macloader sysfs_net:file r_file_perms;
+
+# /sys/module/dhd/parameters/firmware_path
+allow macloader sysfs_wifi_writable:dir r_dir_perms;
+allow macloader sysfs_wifi_writable:file rw_file_perms;
+
+# /sys/wifi
+allow macloader sysfs_wifi:dir r_dir_perms;
+allow macloader sysfs_wifi:file r_file_perms;