From 872e4328210b90a24f8365a63cc0252d8edfcafc Mon Sep 17 00:00:00 2001 From: timmyli Date: Fri, 8 Nov 2024 05:34:12 +0000 Subject: [PATCH] Replace many app service permission with app_api_service We don't need to grant permissions to all these things. Just app_api_service is enough. Bug: 363018500 Test: manual test with GCA Eng Flag: EXEMPT add permissions Change-Id: I2457b54b244b2739e89393f52442afd4544418f1 11-08 00:33:23.429 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=activity scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:activity_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.436 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=display scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:display_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.439 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=network_management scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:network_management_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.453 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=connectivity scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:connectivity_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.457 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=netstats scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:netstats_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.470 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=mount scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:mount_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.488 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=jobscheduler scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:jobscheduler_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.502 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=shortcut scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:shortcut_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.604 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=notification scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:notification_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.606 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=content scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:content_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.627 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=content_capture scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:content_capture_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.630 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=gpu scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:gpu_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.630 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=activity_task scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:activity_task_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.643 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=sensorservice scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:sensorservice_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.644 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=virtualdevice_native scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:virtual_device_native_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.652 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=device_policy scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:device_policy_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.652 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=batterystats scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:batterystats_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.653 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=powerstats scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:powerstats_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.662 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=trust scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:trust_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.677 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=device_state scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:device_state_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.718 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=vibrator_manager scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:vibrator_manager_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.724 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=input_method scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:input_method_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.732 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=power scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:power_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.733 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=thermalservice scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:thermal_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.784 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=voiceinteraction scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:voiceinteraction_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.786 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=autofill scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:autofill_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.795 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=sensitive_content_protection_service scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:sensitive_content_protection_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.798 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=graphicsstats scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:graphicsstats_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.798 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=performance_hint scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:hint_service:s0 tclass=service_manager permissive=1 11-08 00:33:23.835 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=clipboard scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:clipboard_service:s0 tclass=service_manager permissive=1 11-08 00:33:24.029 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=android.frameworks.stats.IStats/default scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:fwk_stats_service:s0 tclass=service_manager permissive=1 11-08 00:33:24.130 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=backup scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:backup_service:s0 tclass=service_manager permissive=1 11-08 00:33:24.160 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=audio scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:audio_service:s0 tclass=service_manager permissive=1 11-08 00:33:24.368 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=android.hardware.neuralnetworks.IDevice/google-edgetpu scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:edgetpu_nnapi_service:s0 tclass=service_manager permissive=1 11-08 00:33:24.364 16052 16052 I GoogleCameraEng: type=1400 audit(0.0:1555): avc: denied { read } for name="enforce" dev="selinuxfs" ino=4 scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:selinuxfs:s0 tclass=file permissive=1 app=com.google.android.GoogleCameraEng 11-08 00:33:24.364 16052 16052 I GoogleCameraEng: type=1400 audit(0.0:1556): avc: denied { open } for path="/sys/fs/selinux/enforce" dev="selinuxfs" ino=4 scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:selinuxfs:s0 tclass=file permissive=1 app=com.google.android.GoogleCameraEng 11-08 00:33:24.650 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=android.frameworks.stats.IStats/default scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:fwk_stats_service:s0 tclass=service_manager permissive=1 11-08 00:33:24.872 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=package_native scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:package_native_service:s0 tclass=service_manager permissive=1 11-08 00:33:26.556 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=input scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:input_service:s0 tclass=service_manager permissive=1 11-08 00:33:34.977 344 344 E SELinux : avc: denied { find } for pid=16052 uid=10296 name=storagestats scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:storagestats_service:s0 tclass=service_manager permissive=1 11-08 00:33:42.547 344 344 E SELinux : avc: denied { find } for pid=16961 uid=10296 name=activity scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:activity_service:s0 tclass=service_manager permissive=1 11-08 00:33:42.593 344 344 E SELinux : avc: denied { find } for pid=16961 uid=10296 name=mount scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:mount_service:s0 tclass=service_manager permissive=1 11-08 00:33:42.656 16961 16961 I GoogleCameraEng: type=1400 audit(0.0:1681): avc: denied { read } for name="enforce" dev="selinuxfs" ino=4 scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:selinuxfs:s0 tclass=file permissive=1 app=com.google.android.GoogleCameraEng 11-08 00:33:42.656 16961 16961 I GoogleCameraEng: type=1400 audit(0.0:1682): avc: denied { open } for path="/sys/fs/selinux/enforce" dev="selinuxfs" ino=4 scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:selinuxfs:s0 tclass=file permissive=1 app=com.google.android.GoogleCameraEng 11-08 00:33:42.726 344 344 E SELinux : avc: denied { find } for pid=16961 uid=10296 name=content scontext=u:r:debug_camera_app:s0:c40,c257,c512,c768 tcontext=u:object_r:content_service:s0 tclass=service_manager permissive=1 Change-Id: I91235f2f699fd07107eaa11174beee895559770e --- .../sepolicy/product/private/debug_camera_app.te | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/gcam_app/sepolicy/product/private/debug_camera_app.te b/gcam_app/sepolicy/product/private/debug_camera_app.te index 4402e55..0449bc0 100644 --- a/gcam_app/sepolicy/product/private/debug_camera_app.te +++ b/gcam_app/sepolicy/product/private/debug_camera_app.te @@ -6,23 +6,12 @@ userdebug_or_eng(` app_domain(debug_camera_app) net_domain(debug_camera_app) - allow debug_camera_app activity_service:service_manager find; - allow debug_camera_app activity_task_service:service_manager find; + allow debug_camera_app app_api_service:service_manager find; allow debug_camera_app audioserver_service:service_manager find; - allow debug_camera_app batterystats_service:service_manager find; allow debug_camera_app cameraserver_service:service_manager find; - allow debug_camera_app device_policy_service:service_manager find; - allow debug_camera_app device_state_service:service_manager find; - allow debug_camera_app gpu_service:service_manager find; allow debug_camera_app mediaextractor_service:service_manager find; allow debug_camera_app mediametrics_service:service_manager find; allow debug_camera_app mediaserver_service:service_manager find; - allow debug_camera_app powerstats_service:service_manager find; - allow debug_camera_app sensorservice_service:service_manager find; - allow debug_camera_app thermal_service:service_manager find; - allow debug_camera_app trust_service:service_manager find; - allow debug_camera_app vibrator_manager_service:service_manager find; - allow debug_camera_app virtual_device_native_service:service_manager find; # Allows GCA_Eng & GCA-Next to access the PowerHAL. hal_client_domain(debug_camera_app, hal_power)