3a6bc68e64
Revise policy, to allow init and system_server to configure, clear, and read kernel trace events. This will enable us to debug certain WiFi failures. Note that system_server is restricted to only accessing a wifi-specific trace instance. (Hence, system_server is not allowed to interfere with atrace.) Moreover, even for the wifi trace instance, system_server is granted limited permissions. (system_server can not, e.g., change which events are traced.) Note also that init and system_server are only granted these powers on userdebug or eng builds. The init.te and system_server.te changes resolve the following denials: // Denials when wifi-events.rc configures tracing { write } for pid=1 comm="init" name="instances" dev="debugfs" ino=755 scontext=u:r:init:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1 { add_name } for pid=1 comm="init" name="wifi" scontext=u:r:init:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1 { create } for pid=1 comm="init" name="wifi" scontext=u:r:init:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1 { write } for pid=1 comm="init" name="tracing_on" dev="debugfs" ino=18067 scontext=u:r:init:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { write } for pid=1 comm="init" name="buffer_size_kb" dev="debugfs" ino=18061 scontext=u:r:init:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=file permissive=1 // Denials when system_server sets up fail-safe // (auto-terminate tracing if system_server dies) { search } for pid=882 comm="system_server" name="instances" dev="debugfs" ino=755 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1 { read } for pid=882 comm="system_server" name="free_buffer" dev="debugfs" ino=18063 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { open } for pid=882 comm="system_server" path="/sys/kernel/debug/tracing/instances/wifi/free_buffer" dev="debugfs" ino=18063 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { getattr } for pid=882 comm="system_server" path="/sys/kernel/debug/tracing/instances/wifi/free_buffer" dev="debugfs" ino=18063 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 // Denials when system_server toggles tracing on or off // (WifiStateMachine is a thread in system_server) { search } for pid=989 comm="WifiStateMachin" name="instances" dev="debugfs" ino=755 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1 { write } for pid=989 comm="WifiStateMachin" name="tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { open } for pid=989 comm="WifiStateMachin" path="/sys/kernel/debug/tracing/instances/wifi/tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { getattr } for pid=989 comm="WifiStateMachin" path="/sys/kernel/debug/tracing/instances/wifi/tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { write } for pid=989 comm="WifiStateMachin" name="tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { open } for pid=989 comm="WifiStateMachin" path="/sys/kernel/debug/tracing/instances/wifi/tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { getattr } for pid=989 comm="WifiStateMachin" path="/sys/kernel/debug/tracing/instances/wifi/tracing_on" dev="debugfs" ino=18067 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 // Denials when system_server reads the event trace // (This happens in response to a dumpsys request) { search } for pid=3537 comm="Binder:882_B" name="instances" dev="debugfs" ino=755 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_tracing_instances:s0 tclass=dir permissive=1 { read } for pid=3537 comm="Binder:882_B" name="trace" dev="debugfs" ino=18059 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { open } for pid=3537 comm="Binder:882_B" path="/sys/kernel/debug/tracing/instances/wifi/trace" dev="debugfs" ino=18059 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { getattr } for pid=3537 comm="Binder:882_B" path="/sys/kernel/debug/tracing/instances/wifi/trace" dev="debugfs" ino=18059 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 { write } for pid=3537 comm="Binder:882_B" name="trace" dev="debugfs" ino=18059 scontext=u:r:system_server:s0 tcontext=u:object_r:debugfs_wifi_tracing:s0 tclass=file permissive=1 Bug: 27254565 Test: manual Manual test: - Build this CL along with CL:322337 - Verify that system boots, and that we can connect to GoogleGuest. (Testing of actual trace functionality with require some more patches in frameworks/opt/net/wifi.) $ adb root && adb shell dmesg | egrep 'avc: denied.+debugfs' Change-Id: Ib6eb4116549277f85bd510d25fb30200f1752f4d |
||
---|---|---|
.. | ||
adbd.te | ||
app.te | ||
atrace.te | ||
attributes | ||
audioserver.te | ||
binderservicedomain.te | ||
blkid.te | ||
blkid_untrusted.te | ||
bluetooth.te | ||
bluetoothdomain.te | ||
boot_control_hal.te | ||
bootanim.te | ||
bootstat.te | ||
cameraserver.te | ||
charger.te | ||
clatd.te | ||
cppreopts.te | ||
crash_dump.te | ||
device.te | ||
dex2oat.te | ||
dhcp.te | ||
dnsmasq.te | ||
domain.te | ||
domain_deprecated.te | ||
drmserver.te | ||
dumpstate.te | ||
ephemeral_app.te | ||
file.te | ||
fingerprintd.te | ||
fsck.te | ||
fsck_untrusted.te | ||
gatekeeperd.te | ||
global_macros | ||
hal_allocator.te | ||
hal_audio.te | ||
hal_bluetooth.te | ||
hal_boot.te | ||
hal_camera.te | ||
hal_contexthub.te | ||
hal_dumpstate.te | ||
hal_fingerprint.te | ||
hal_gatekeeper.te | ||
hal_gnss.te | ||
hal_graphics_allocator.te | ||
hal_graphics_composer.te | ||
hal_health.te | ||
hal_ir.te | ||
hal_light.te | ||
hal_memtrack.te | ||
hal_nfc.te | ||
hal_power.te | ||
hal_sensors.te | ||
hal_telephony.te | ||
hal_thermal.te | ||
hal_vibrator.te | ||
hal_vr.te | ||
hal_wifi.te | ||
healthd.te | ||
hostapd.te | ||
hwservicemanager.te | ||
idmap.te | ||
init.te | ||
inputflinger.te | ||
install_recovery.te | ||
installd.te | ||
ioctl_defines | ||
ioctl_macros | ||
isolated_app.te | ||
kernel.te | ||
keystore.te | ||
lmkd.te | ||
logd.te | ||
logpersist.te | ||
mdnsd.te | ||
mediaanalytics.te | ||
mediacodec.te | ||
mediadrmserver.te | ||
mediaextractor.te | ||
mediaserver.te | ||
mtp.te | ||
net.te | ||
netd.te | ||
neverallow_macros | ||
nfc.te | ||
otapreopt_chroot.te | ||
otapreopt_slot.te | ||
perfprofd.te | ||
platform_app.te | ||
postinstall.te | ||
postinstall_dexopt.te | ||
ppp.te | ||
preopt2cachename.te | ||
priv_app.te | ||
profman.te | ||
property.te | ||
racoon.te | ||
radio.te | ||
recovery.te | ||
recovery_persist.te | ||
recovery_refresh.te | ||
rild.te | ||
roles | ||
runas.te | ||
sdcardd.te | ||
service.te | ||
servicemanager.te | ||
sgdisk.te | ||
shared_relro.te | ||
shell.te | ||
slideshow.te | ||
su.te | ||
surfaceflinger.te | ||
system_app.te | ||
system_server.te | ||
te_macros | ||
tee.te | ||
tombstoned.te | ||
toolbox.te | ||
tzdatacheck.te | ||
ueventd.te | ||
uncrypt.te | ||
untrusted_app.te | ||
update_engine.te | ||
update_engine_common.te | ||
update_verifier.te | ||
vdc.te | ||
vold.te | ||
watchdogd.te | ||
webview_zygote.te | ||
wificond.te | ||
wpa.te | ||
zygote.te |