[SELinux] Allow NNAPI HAL to log traces to perfetto under userdebug builds

Allows DarwiNN NNAPI HAL to log traces to perfetto only under userdebug builds. This is similar to the camera HAL fix in ag/17080874

Error message:
TracingMuxer: type=1400 audit(0.0:486): avc: denied { write } for name="traced_producer" dev="tmpfs" ino=1116 scontext=u:r:hal_neuralnetworks_darwinn:s0

This rule is common for EdgeTPU in both WHI and PRO.

Bug: 231838536

Test: tested on PRO before and after the change, and the traces now shows up.

Example: https://ui.perfetto.dev/#!/?s=ab911b3972bc16a1a831e148a7446c09757a08426bbe3c3b16d31a728b1d923
https://screenshot.googleplex.com/3roWETkTFyiDjW9

Change-Id: I8d4a57e262087aa4ec6670a487d7b06d2f2cde69
This commit is contained in:
Richard Hsu 2022-05-07 21:37:28 -07:00
parent 18cb713b62
commit 5675757d41

View file

@ -47,3 +47,7 @@ allow hal_neuralnetworks_darwinn sysfs_edgetpu:file r_file_perms;
# Allows the NNAPI HAL to access the edgetpu_app_service # Allows the NNAPI HAL to access the edgetpu_app_service
allow hal_neuralnetworks_darwinn edgetpu_app_service:service_manager find; allow hal_neuralnetworks_darwinn edgetpu_app_service:service_manager find;
binder_call(hal_neuralnetworks_darwinn, edgetpu_app_server); binder_call(hal_neuralnetworks_darwinn, edgetpu_app_server);
# Allow NNAPI HAL to send trace packets to Perfetto with SELinux enabled
# under userdebug builds.
userdebug_or_eng(`perfetto_producer(hal_neuralnetworks_darwinn)')