Merge changes from topic "lpdumpd"
* changes:
Add rules for lpdump and lpdumpd
Allow to getattr kmsg_device
diff --git a/private/atrace.te b/private/atrace.te
index 7979fa1..0cdd35a 100644
--- a/private/atrace.te
+++ b/private/atrace.te
@@ -45,6 +45,7 @@
-dumpstate_service
-installd_service
-vold_service
+ -lpdump_service
}:service_manager { find };
allow atrace servicemanager:service_manager list;
diff --git a/private/compat/28.0/28.0.ignore.cil b/private/compat/28.0/28.0.ignore.cil
index 40a001f..8187e29 100644
--- a/private/compat/28.0/28.0.ignore.cil
+++ b/private/compat/28.0/28.0.ignore.cil
@@ -84,6 +84,10 @@
llkd_prop
llkd_tmpfs
looper_stats_service
+ lpdumpd
+ lpdumpd_exec
+ lpdumpd_prop
+ lpdump_service
iorapd
iorapd_exec
iorapd_data_file
diff --git a/private/file_contexts b/private/file_contexts
index a3723e2..35796fb 100644
--- a/private/file_contexts
+++ b/private/file_contexts
@@ -262,6 +262,7 @@
/system/bin/usbd u:object_r:usbd_exec:s0
/system/bin/inputflinger u:object_r:inputflinger_exec:s0
/system/bin/logd u:object_r:logd_exec:s0
+/system/bin/lpdumpd u:object_r:lpdumpd_exec:s0
/system/bin/rss_hwm_reset u:object_r:rss_hwm_reset_exec:s0
/system/bin/perfetto u:object_r:perfetto_exec:s0
/system/bin/traced u:object_r:traced_exec:s0
diff --git a/private/lpdumpd.te b/private/lpdumpd.te
new file mode 100644
index 0000000..9acd22b
--- /dev/null
+++ b/private/lpdumpd.te
@@ -0,0 +1,45 @@
+type lpdumpd, domain, coredomain;
+type lpdumpd_exec, system_file_type, exec_type, file_type;
+
+init_daemon_domain(lpdumpd)
+
+# Allow lpdumpd to register itself as a service.
+binder_use(lpdumpd)
+add_service(lpdumpd, lpdump_service)
+
+# Allow lpdumpd to find the super partition block device.
+allow lpdumpd block_device:dir r_dir_perms;
+
+# Allow lpdumpd to read super partition metadata. This may live on
+# super_block_device, or system_block_device (on retrofit devices).
+allow lpdumpd {
+ super_block_device
+ system_block_device
+}:blk_file r_file_perms;
+
+# Allow lpdumpd to read fstab.
+allow lpdumpd sysfs_dt_firmware_android:dir r_dir_perms;
+allow lpdumpd sysfs_dt_firmware_android:file r_file_perms;
+
+# Triggered when lpdumpd tries to read default fstab.
+dontaudit lpdumpd metadata_file:dir r_dir_perms;
+dontaudit lpdumpd metadata_file:file r_file_perms;
+dontaudit lpdumpd gsi_metadata_file:dir r_dir_perms;
+dontaudit lpdumpd gsi_metadata_file:file r_file_perms;
+
+### Neverallow rules
+
+# Disallow other domains to get lpdump_service and call lpdumpd.
+neverallow {
+ domain
+ -dumpstate
+ -lpdumpd
+ -shell
+} lpdump_service:service_manager find;
+
+neverallow {
+ domain
+ -dumpstate
+ -lpdumpd
+ -shell
+} lpdumpd:binder call;
diff --git a/private/property_contexts b/private/property_contexts
index 3261014..3622d12 100644
--- a/private/property_contexts
+++ b/private/property_contexts
@@ -23,6 +23,7 @@
ro.hw. u:object_r:system_prop:s0
sys. u:object_r:system_prop:s0
sys.cppreopt u:object_r:cppreopt_prop:s0
+sys.lpdumpd u:object_r:lpdumpd_prop:s0
sys.powerctl u:object_r:powerctl_prop:s0
sys.usb.ffs. u:object_r:ffs_prop:s0
service. u:object_r:system_prop:s0
diff --git a/private/service_contexts b/private/service_contexts
index 7ee4827..de56972 100644
--- a/private/service_contexts
+++ b/private/service_contexts
@@ -103,6 +103,7 @@
location u:object_r:location_service:s0
lock_settings u:object_r:lock_settings_service:s0
looper_stats u:object_r:looper_stats_service:s0
+lpdump_service u:object_r:lpdump_service:s0
media.aaudio u:object_r:audioserver_service:s0
media.audio_flinger u:object_r:audioserver_service:s0
media.audio_policy u:object_r:audioserver_service:s0
diff --git a/private/shell.te b/private/shell.te
index 0d1cf03..02b01f5 100644
--- a/private/shell.te
+++ b/private/shell.te
@@ -70,3 +70,7 @@
# Renderscript host side tests depend on being able to execute
# /system/bin/bcc (b/126388046)
allow shell rs_exec:file rx_file_perms;
+
+# Allow shell to start and comminicate with lpdumpd.
+set_prop(shell, lpdumpd_prop);
+binder_call(shell, lpdumpd)
diff --git a/private/system_app.te b/private/system_app.te
index 9a5e455..05831a3 100644
--- a/private/system_app.te
+++ b/private/system_app.te
@@ -80,6 +80,7 @@
-installd_service
-iorapd_service
-ipmemorystore_service
+ -lpdump_service
-netd_service
-system_suspend_control_service
-virtual_touchpad_service
diff --git a/public/fastbootd.te b/public/fastbootd.te
index 7b71c2c..d63af83 100644
--- a/public/fastbootd.te
+++ b/public/fastbootd.te
@@ -16,7 +16,7 @@
allowxperm fastbootd functionfs:file ioctl { FUNCTIONFS_ENDPOINT_DESC };
# Log to serial
- allow fastbootd kmsg_device:chr_file { open write };
+ allow fastbootd kmsg_device:chr_file { open getattr write };
# battery info
allow fastbootd sysfs_batteryinfo:file r_file_perms;
diff --git a/public/hal_health.te b/public/hal_health.te
index 019b523..dc7d083 100644
--- a/public/hal_health.te
+++ b/public/hal_health.te
@@ -21,7 +21,7 @@
wakelock_use(hal_health_server)
# Write to /dev/kmsg
-allow hal_health_server kmsg_device:chr_file w_file_perms;
+allow hal_health_server kmsg_device:chr_file { getattr w_file_perms };
# Allow to use timerfd to wake itself up periodically to send health info.
allow hal_health_server self:capability2 wake_alarm;
diff --git a/public/init.te b/public/init.te
index f5f42e7..739cc2e 100644
--- a/public/init.te
+++ b/public/init.te
@@ -11,7 +11,7 @@
#
# /dev/kmsg
allow init tmpfs:chr_file relabelfrom;
-allow init kmsg_device:chr_file { write relabelto };
+allow init kmsg_device:chr_file { getattr write relabelto };
# /dev/kmsg_debug
userdebug_or_eng(`
allow init kmsg_debug_device:chr_file { write relabelto };
diff --git a/public/logd.te b/public/logd.te
index 6aac302..0cbefb4 100644
--- a/public/logd.te
+++ b/public/logd.te
@@ -11,7 +11,7 @@
allow logd self:global_capability2_class_set syslog;
allow logd self:netlink_audit_socket { create_socket_perms_no_ioctl nlmsg_write };
allow logd kernel:system syslog_read;
-allow logd kmsg_device:chr_file w_file_perms;
+allow logd kmsg_device:chr_file { getattr w_file_perms };
allow logd system_data_file:{ file lnk_file } r_file_perms;
allow logd pstorefs:dir search;
allow logd pstorefs:file r_file_perms;
diff --git a/public/property.te b/public/property.te
index 044e5eb..473baa2 100644
--- a/public/property.te
+++ b/public/property.te
@@ -58,6 +58,7 @@
type log_prop, property_type, log_property_type;
type log_tag_prop, property_type, log_property_type;
type lowpan_prop, property_type;
+type lpdumpd_prop, property_type;
type mmc_prop, property_type;
type net_dns_prop, property_type;
type net_radio_prop, property_type, core_property_type;
@@ -430,6 +431,7 @@
-logd_prop
-logpersistd_logging_prop
-lowpan_prop
+ -lpdumpd_prop
-mmc_prop
-net_dns_prop
-net_radio_prop
diff --git a/public/service.te b/public/service.te
index bc4be2a..a6385b8 100644
--- a/public/service.te
+++ b/public/service.te
@@ -16,6 +16,7 @@
type incident_service, service_manager_type;
type installd_service, service_manager_type;
type keystore_service, service_manager_type;
+type lpdump_service, service_manager_type;
type mediaserver_service, service_manager_type;
type mediametrics_service, service_manager_type;
type mediaextractor_service, service_manager_type;
diff --git a/public/traceur_app.te b/public/traceur_app.te
index 7ded147..4dea890 100644
--- a/public/traceur_app.te
+++ b/public/traceur_app.te
@@ -14,6 +14,7 @@
-installd_service
-ipmemorystore_service
-iorapd_service
+ -lpdump_service
-netd_service
-virtual_touchpad_service
-vold_service
diff --git a/public/update_engine.te b/public/update_engine.te
index 6521726..7bcaca6 100644
--- a/public/update_engine.te
+++ b/public/update_engine.te
@@ -13,7 +13,7 @@
# denial.
dontaudit update_engine self:global_capability_class_set fsetid;
-allow update_engine kmsg_device:chr_file w_file_perms;
+allow update_engine kmsg_device:chr_file { getattr w_file_perms };
allow update_engine update_engine_exec:file rx_file_perms;
wakelock_use(update_engine);
diff --git a/public/update_verifier.te b/public/update_verifier.te
index 0a9090c..8d40cdd 100644
--- a/public/update_verifier.te
+++ b/public/update_verifier.te
@@ -22,7 +22,7 @@
allow update_verifier dm_device:blk_file r_file_perms;
# Write to kernel message.
-allow update_verifier kmsg_device:chr_file w_file_perms;
+allow update_verifier kmsg_device:chr_file { getattr w_file_perms };
# Allow update_verifier to reboot the device.
set_prop(update_verifier, powerctl_prop)
diff --git a/public/vdc.te b/public/vdc.te
index b59dcf6..e638e50 100644
--- a/public/vdc.te
+++ b/public/vdc.te
@@ -12,7 +12,7 @@
allow vdc devpts:chr_file rw_file_perms;
# vdc writes directly to kmsg during the boot process
-allow vdc kmsg_device:chr_file w_file_perms;
+allow vdc kmsg_device:chr_file { getattr w_file_perms };
# vdc talks to vold over Binder
binder_use(vdc)
diff --git a/public/vendor_init.te b/public/vendor_init.te
index 6ed7b02..5a3e918 100644
--- a/public/vendor_init.te
+++ b/public/vendor_init.te
@@ -5,7 +5,7 @@
allow vendor_init init:unix_stream_socket { read write };
# Logging to kmsg
-allow vendor_init kmsg_device:chr_file { open write };
+allow vendor_init kmsg_device:chr_file { open getattr write };
# Mount on /dev/usb-ffs/adb.
allow vendor_init device:dir mounton;