Commit graph

992 commits

Author SHA1 Message Date
Carmen Jackson
33c057444a Add rule for system_server to send Perfetto a signal
Cancelling/ending traces wasn't working properly in the Developer
Telemetry APIs due to this missing rule. Now, calling destroyForcibly
on the Perfetto process running the trace successfully kills the
process.

Bug: 293957254
Test: locally with atest ProfilingFrameworkTests#testRequestProfilingCancel
Change-Id: I91d83dde01897eb9e48cf4a90e44d088c3f2a45f
2024-03-19 05:36:22 +00:00
Alan Stokes
d2bc72b7eb Merge "Add virtualization_maintenance_service" into main 2024-02-22 09:45:13 +00:00
Yisroel Forta
c5cb5a248d Add context that system server can access and perfetto can save traces to
Give perfetto rw dir and create file permissions for new directory.
Give system server control to read, write, search, unlink files from new directory.

Test: locally ensure traces can be written by perfetto and accessed and deleted by system server
Bug: 293957254
Change-Id: Id015429b48ffffb73e7a71addddd48a22e4740bf
2024-02-21 16:43:57 +00:00
Alan Stokes
38131e7ba8 Add virtualization_maintenance_service
This is an AIDL service exposed by Virtualization Service to system
server (VirtualizationSystemService).

The implementation is Rust so no fuzzer is required.

I've put this behind the flag on general principle.

Bug: 294177871
Test: atest MicrodroidTests
Change-Id: Ia867fe27fb2e76d9688e4ba650ebf7b3f51ee597
2024-02-20 17:08:28 +00:00
Dennis Shen
6c8210da20 selinux setup for files under /metadata/aconfig dir
1, /metadata/aconfig is the directory that stores aconfig storage
related protobuf files and flag value files boot copy. Grant read
access to everybody. But limit the write access only to init and
aconfig storage service process (to be created later)

2, /metadata/aconfig/flags is the sub directory that stores persistent
aconfig value files.Initially set it up to be accessible by
system_server process only . When aconfig storage service process is
created, will add another permission to storage service process.

Context to why we are hosting flag data on /metadata partition:

Android is adopting trunk stable workflow, flagging and A/B testing is
essential to every platform component. We need some place to host the
flag that are accessible to system processes that starts before /data
partition becomes available.

In addition, there has been a long discussion regarding utilizing
/metadata partition for some process data, another example is mainline
modules, we are trying to make them to be able to be mounted earlier,
but cannot due to /data availability.

Bug: 312444587
Test: m
Change-Id: I7e7dae5cf8c4268d71229c770af31b5e9f071428
2024-02-14 17:56:29 +00:00
Carmen Jackson
28b811df1c Add rules for Perfetto to be used from system_server
This includes rules for starting Perfetto as well as rules for
communicating over stdio between Perfetto and system_server.

Bug: 293957254
Test: Presubmit & tested in conjunction with internal change
Change-Id: I7e4c044a6a2afb48c33d65cc421e797d77aacc12
2024-02-12 18:33:32 +00:00
Jiakai Zhang
817c49f74c Update sepolicy for service dexopt_chroot_setup and artd_pre_reboot.
Bug: 311377497
Test: manual - Call
  getDexoptChrootSetupServiceRegisterer().waitForService()
Test: manual - Set up a chroot environment and call
  getArtdPreRebootServiceRegisterer().waitForService()
Change-Id: I50b5f7f858dab37f05174cb9787f64303d50d083
2024-02-08 10:13:27 +08:00
Harshit Mahajan
d02643a3ed Merge "Revert^2 "Adding sepolicy rules for CrashRecoveryProperties"" into main 2024-02-02 16:24:56 +00:00
Hansen Kurli
34ee0b5da3 Merge "Remove all sepolicy relating to ppp/mtp." into main 2024-02-02 05:16:37 +00:00
Carlos Galo
878f7f1795 Merge "system_server: remove access to proc/memhealth/*" into main 2024-02-02 04:26:54 +00:00
Carlos Galo
4a9f07fe21 system_server: remove access to proc/memhealth/*
Memhealth driver has been removed from all android kernels.

Test: m
Bug: 315560026
Change-Id: Ia4f91bde3a999a490b42b57abcd521ff9cc94633
Signed-off-by: Carlos Galo <carlosgalo@google.com>
2024-02-01 23:40:25 +00:00
Harshit Mahajan
7740a47b34 Revert^2 "Adding sepolicy rules for CrashRecoveryProperties"
This reverts commit f76b3cf07a.

Reason for revert: This part is not causing failures

Change-Id: I3c01877f7473f35552e43433c069664276a99067
2024-02-01 13:00:46 +00:00
Bubble Fang
e12fc98b59 Merge "Revert "Adding sepolicy rules for CrashRecoveryProperties"" into main 2024-02-01 08:44:38 +00:00
Bubble Fang
f76b3cf07a Revert "Adding sepolicy rules for CrashRecoveryProperties"
Revert submission 2931990-cr-sysprop

Reason for revert: Causing CTS fail at b/323272250 b/323278067 b/323284822

Reverted changes: /q/submissionid:2931990-cr-sysprop

Change-Id: I41c3804cb5b6e0aff0cc8e90995d0e65888c7988
2024-02-01 06:42:28 +00:00
Harshit Mahajan
fedcb415a7 Merge "Adding sepolicy rules for CrashRecoveryProperties" into main 2024-02-01 00:59:34 +00:00
Harshit Mahajan
3e37acd48f Adding sepolicy rules for CrashRecoveryProperties
Restricting that properties can only be written by platform and module.
It will be read and written from init and sytem_server.

Bug: b/289203818
Test: m
Change-Id: Ie6b44d1222ec1a9fbfc9b90e0455588f9defe848
2024-01-31 12:52:10 +00:00
Hansen Kurli
ff6cb347be Remove all sepolicy relating to ppp/mtp.
Legacy VPNs are removed, including the usage of mtpd/pppd.
Only the type ppp and mtp remain as there are usages elsewhere.

Bug: 161776767
Test: m, presubmit
Change-Id: I556b0daa55f9ea7bf844f6a52d10dda02e324ee0
2024-01-30 17:46:49 +08:00
Treehugger Robot
14d7483a93 Merge "Allow system_server to find hal_bluetooth with service_manager" into main 2024-01-29 08:48:23 +00:00
Ted Wang
fb2d929c48 Allow system_server to find hal_bluetooth with service_manager
Bug: 322731389
Test: make and check if there is avc denied.
Change-Id: Ifb0fef383c42e7b6045dfa4ff9240ef2315be2f1
2024-01-29 07:31:57 +00:00
Hansen Kurli
59bd48484b Merge "Remove all sepolicy relating to racoon" into main 2024-01-26 09:48:22 +00:00
Andrea Zilio
410b2ae5fd Enable system server to read pm.archiving.enabled system property, as system server will need this check to have the archiving feature during testing.
Change-Id: Ia75f3ea0570075e9600548e24e42f17a783187ba
Bug: 321730881
Test: Presubmit
2024-01-26 01:50:27 +00:00
Zhanglong Xia
1d75b43704 Add sepolicy for the Thread Network property
This CL adds sepolicy for the system property
threadnetwork.country_code. This system property
is set by init and be read by the ThreadNetworkService.

Bug: b/309357909
Test: Configure the system property in ini.product.rc and
      check the configured country code via the command
      `dumpsys thread_network`.

Change-Id: I6f067ced24842755f2c5519169ba9a94df17829f
2024-01-15 11:48:20 +08:00
Kangping Dong
e21496b105 [Thread] move Thread settings data to APEX data dir
This commit includes two sepolicy changes:
1. change threadnetwork data file to
/data/misc/apexdata/com.android.tethering/threadnetwork
2. use apex_tethering_data_file for files under
   /data/misc/apexdata/com.android.tethering

The background is that the Thread daemon (ot_daemon) is merged into the
Tethering mainline module, which means the the Tehtering module now has
code running in both system_server and the standalone unprivileged
ot_daemon process. To prevent ot_daemon from accessing other
apex_system_server_data_file dirs, here use the specific
apex_tethering_data_file for both Tethering and Thread files (A
subdirectory threadnetwork/ will be created for Thread at runtime). This
is similar to apex_art_data_file and apex_virt_data_file.

Note that a file_contexts rule like
```
/data/misc/apexdata/com\.android\.tethering/threadnetwork(/.*)?  u:object_r:apex_threadnetwork_data_file:s0
```
won't work because the threadnetwork/ subdir doesn't exist before the
sepolicy rules are evaluated.

Bug: 309932508
Test: manually verified that Thread settings file can be written to
      /data/misc/apexdata/com.android.tethering/threadnetwork
Change-Id: I66539865ef388115c8e9b388b43291d8faf1f384
2024-01-03 23:01:24 +08:00
Yu-Ting Tseng
4de7a537b0 Merge "Revert^2 "Update uprobestats SELinux policy"" into main 2023-12-15 18:02:57 +00:00
Yu-Ting Tseng
43cae4ea24 Revert^2 "Update uprobestats SELinux policy"
This reverts commit 5e1d7f1c85.

Reason for revert: retry with a fix to the failed tests

Test: atest art_standalone_oatdump_tests
Change-Id: I28872c643ba4ec07ef41b1f9be86036c592a6e4e
2023-12-14 17:17:18 -08:00
Yu-Ting Tseng
5e1d7f1c85 Revert "Update uprobestats SELinux policy"
This reverts commit a87a13f16c.

Reason for revert: b/316386186

Change-Id: Ia39371ee9d96c1b1fdf71d67abc7765019c4f185
2023-12-14 19:50:49 +00:00
Yu-Ting Tseng
a87a13f16c Update uprobestats SELinux policy
The changes include
- allow binder calls to ActivityManager and NativePackageManager
- allow binder calls from system server
- allow writes of statsd atoms
- allow init to start uprobestats
- permission for uprobestats config files and propery
- allow execution of oatdump so it can look up code offsets
- allow scanning /proc.

Test: m selinux_policy
Change-Id: Id1864b7dac3a2c5dcd8736c4932778e36b658ce3
2023-12-13 16:49:23 -08:00
Jiakai Zhang
ac3d139e24 Allow watchdog to dump artd.
Bug: 314171605
Change-Id: Iabb2da390dfe68e9993e0dc7023297afd51a8b3c
Test: Presubmit
2023-12-12 13:22:16 +00:00
Steven Moreland
073b71671c Merge "allow watchdog to dump servicemanager" into main 2023-12-07 18:08:08 +00:00
Steven Moreland
5830ddb1d9 allow watchdog to dump servicemanager
Cmd line: /system/bin/servicemanager
ABI: 'x86_64'

"servicemanager" sysTid=202
  NOTE: Function names and BuildId information is missing for some frames due
  NOTE: to unreadable libraries. For unwinds of apps, only shared libraries
  NOTE: found under the lib/ directory are readable.
  NOTE: On this device, run setenforce 0 to make the libraries readable.
  NOTE: Unreadable libraries:
  NOTE:   /system/lib64/bootstrap/libc.so
    #00 pc 00000000000babda  /system/lib64/bootstrap/libc.so
    #01 pc 0000000000017819  /system/lib64/libutils.so (android::Looper::pollAll(int, int*, int*, void**)+441) (BuildId: 2ed0ced7383d1676a37aed1236486ac3)
    #02 pc 0000000000011a25  /system/bin/servicemanager (main+1157) (BuildId: 509b83cb97addfa90aaa4ad911c2a3df)
    #03 pc 00000000000547a9  /system/lib64/bootstrap/libc.so

Bug: 314088872
Test: adb shell am hang and check ANRs
Change-Id: I7daf19a3afbd18aa93093fb152f9555022ece88f
2023-12-04 23:24:41 +00:00
Daniel Norman
4245d0413b Allow system_server access to hidraw devices.
This allows AccessibilityManagerService in system_server to
interact with a HID-supported Braille Display.

Bug: 303522222
Test: ls -z /dev/hidraw0
Test: plat_file_contexts_test
Test: Open FileInputStream and FileOutputStream on this device
      path from AccessibilityManagerService
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:67a63cc046769759aa43cf1653f11e57c55cd1db)
Merged-In: I2982e907bd2a70c1e4e8161647d6efd65110b99c
Change-Id: I2982e907bd2a70c1e4e8161647d6efd65110b99c
2023-11-30 23:33:55 +00:00
Hansen Kurli
1aac0c51a0 Remove all sepolicy relating to racoon
Legacy VPNs are removed, including the usage of racoon.

Bug: 161776767
Test: m
Change-Id: I8211b3f00cc0213b1c89b269857adc7c21b97efb
2023-11-28 14:16:07 +08:00
Alice Wang
e79bbf9cf8 Revert^4 "[avf][rkp] Allow virtualizationservice to register RKP HAL"
Revert submission 2829351-revert-2812456-revert-2812435-revert-2778549-expose-avf-rkp-hal-GTFGLMUUKQ-PAWNEHUQBT-WYENGHRTXK

Reason for revert: Relands the original topic:
https://r.android.com/q/topic:%22expose-avf-rkp-hal%22

Changes from the reverted cl aosp/2812455:
 - The AIDL service type has been renamed from avf_* to hal_* to be
   consistent with the others.

 - The new AIDL service type, hal_remotelyprovisionedcomponent_avf_service,
   for the IRPC/avf service, has been set up with the server/client model
   for AIDL Hal. The virtualizationservice is declared as server and
   RKPD is declared as client to access the service instead of raw
   service permission setup as in the reverted cl. This is aligned
   with the AIDL Hal configuration recommendation.

 - Since the existing type for IRPC hal_remotelyprovisionedcomponent is
   already associated with keymint server/client and has specific
   permission requirements, and some of the keymint clients might not
   need the AVF Hal. We decided to create a new AIDL service type
   instead of reusing the exisiting keymint service type.

Reverted changes: /q/submissionid:2829351-revert-2812456-revert-2812435-revert-2778549-expose-avf-rkp-hal-GTFGLMUUKQ-PAWNEHUQBT-WYENGHRTXK

Bug: 312427637
Bug: 310744536
Bug: 299257581
Test: atest MicrodroidHostTests librkp_support_test
Change-Id: Id37764b5f98e3c30c0c63601560697cf1c02c0ad
2023-11-22 08:21:27 +00:00
Ján Sebechlebský
5d6b66c8ea Revert^2 "Allow system_server to communicate with virtual_camera"
This reverts commit 76a62dfb3e.

Reason for revert: Relanding with virtual_camera flag disabled to prevent test failures before rc entry is added for the service (which needs to be done after this cl is submitted to prevent boot test failing due to selinux denials).

Test: https://android-build.corp.google.com/builds/abtd/run/L11500030000350228
Change-Id: Ie621f89610b173918bb4c0b6eb1f35547f56f6b7
2023-11-20 10:42:11 +01:00
Matt Stokes
76a62dfb3e Revert "Allow system_server to communicate with virtual_camera"
This reverts commit 45f1ecee7a.

Reason for revert: <Droid TestMonitor b/311401010>

Change-Id: I82716e9d52a66018c5e7d7d13c8292d7d19f253c
2023-11-16 17:42:25 +00:00
Vadim Caen
45f1ecee7a Allow system_server to communicate with virtual_camera
and consitently name service and process as "virtual_camera" (with
underscore)

Test: Cts VirtalCameraTest
Bug: 270352264
Change-Id: I2c6c0c03aab47aa1795cbda19af25e6661a0bf4a
2023-11-14 15:27:57 +01:00
Maciej Żenczykowski
899fdae61f Merge "system_server dontaudit key_socket getopt" into main 2023-11-08 20:21:38 +00:00
Maciej Żenczykowski
70be64b77c system_server dontaudit key_socket getopt
11-08 07:52:43.776 1469 1469 I auditd : type=1400 audit(0.0:4): avc: denied { getopt } for comm="system_server" scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=key_socket permissive=0
11-08 07:52:44.360 1469 1469 I auditd : type=1400 audit(0.0:5): avc: denied { getopt } for comm="NetworkStats" scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=key_socket permissive=0
11-08 07:52:44.508 1469 1469 I auditd : type=1400 audit(0.0:7): avc: denied { getopt } for comm="android.bg" scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=key_socket permissive=0

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6799c6fcfed0454f32607150320c0ed12301071c
2023-11-08 08:28:16 +00:00
James Willcox
f70225771d Merge "Add new keystore2 permission get_last_auth_time." into main 2023-11-02 21:09:20 +00:00
Victor Hsieh
807cd72034 Merge "Allow system_server to read sepolicy from sysfs" into main 2023-11-02 14:47:30 +00:00
Victor Hsieh
5d102ffeb1 Allow system_server to read sepolicy from sysfs
Bug: 308471499
Test: let system server hash the policy
Change-Id: I8fc171e25636698d787be029c00471e0768f4c7a
2023-11-01 15:02:53 -07:00
James Willcox
038f859db2 Add new keystore2 permission get_last_auth_time.
This is checked when getting the time of last successful authentication
from keystore2. The auth_service is the only expected caller.

Bug: 303839446
Test: manual
Change-Id: Idf222e69c0553a7be94206b519a95a4006e69507
2023-10-31 20:28:43 +00:00
David Drysdale
c4ab01baad Add sepolicy for non-secure AuthGraph impl
Bug: 284470121
Bug: 291228560
Test: hal_implementation_test
Test: VtsAidlAuthGraphSessionTest
Change-Id: I85bf9e0656bab3c96765cc15a5a983aefb6af66d
2023-10-26 02:00:43 +00:00
Andy Yu
e2fb30d461 Add a new sysprops for toggling game default frame rate
Create a new system property for game default frame
rate. A toggle system setting UI will set
`persist.graphics.game_default_frame_rate.enabled`
via GameMangerService in system_server.

`persist.graphics.game_default_frame_rate.enabled` == 1:
    default frame rate enabled
`persist.graphics.game_default_frame_rate.enabled` == 0:
    default frame rate disabled

Bug: 286084594
Test: m, flash and boots properly on Raven
Change-Id: Iae7ebf39aad6c81475ef3d289d750a818fd4ef79
2023-10-23 15:05:24 -07:00
Rhed Jao
ebe1316695 Create sepolicy for allowing system_server rw in /metadata/repair-mode
Bug: 277561275
Test: ls -all -Z /metadata/repair-mode
Change-Id: Ie27b6ef377bb3503e87fbc5bb2446bc0de396123
2023-10-23 13:38:38 +11:00
Li Li
0b3f585a63 Allow system server read binderfs stats
When receiving the binder transaction errors reported by Android
applications, AMS needs a way to verify that information. Currently
Linux kernel doesn't provide such an API. Use binderfs instead until
kernel binder driver adds that functionality in the future.

Bug: 199336863
Test: send binder calls to frozen apps and check logcat
Test: take bugreport and check binder stats logs
Change-Id: I3bab3d4f35616b4a7b99d6ac6dc79fb86e7f28d4
2023-10-20 13:22:24 -07:00
Eric Biggers
d7fe10be98 Stop granting permission to get_state of keystore2
The get_state permission of the "keystore2" class only guarded the
Binder API IKeystoreMaintenance#getState() served by keystore2.  That
API has been removed because it was unused
(https://r.android.com/2768246).  Therefore, stop granting the get_state
permission.

Don't actually remove the permission from private/access_vectors.  That
would break the build because it's referenced by rules in prebuilts/.

Bug: 296464083
Test: atest CtsKeystoreTestCases
Change-Id: Ie6c7b17a8652f86a75d48c134a6e71a634d63772
2023-10-16 22:22:57 +00:00
Eric Biggers
cc5cb431ee Stop granting permissions on keystore_key class
When keystore was replaced with keystore2 in Android 12, the SELinux
class of keystore keys was changed from keystore_key to keystore2_key.
However, the rules that granted access to keystore_key were never
removed.  This CL removes them, as they are no longer needed.

Don't actually remove the class and its permissions from
private/security_classes and private/access_vectors.  That would break
the build because they're referenced by rules in prebuilts/.

Bug: 171305684
Test: atest CtsKeystoreTestCases
Flag: exempt, removing obsolete code
Change-Id: I35d9ea22c0d069049a892def15a18696c4f287a3
2023-10-16 22:22:54 +00:00
Dennis Shen
bb028e3e9a add next_boot_prop SELinux context to store staged sys prop
Bug: b/300111812
Change-Id: I02f1ba586fb6dfec90ae1ff6d4bb6518f294c5d7
Merged-In: I02f1ba586fb6dfec90ae1ff6d4bb6518f294c5d7
2023-10-12 16:12:30 +00:00
Victor Hsieh
f5900cbb89 Merge "Allow system_server to enable fs-verity on staging APK" into main am: 8ee7e50799
Original change: https://android-review.googlesource.com/c/platform/system/sepolicy/+/2759627

Change-Id: Idfaab2dda7dd63b69a3d7d4d5955a393dd9347d9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-25 16:20:23 +00:00