Commit graph

44075 commits

Author SHA1 Message Date
Sandro Montanari
4db0e27a50 Introduce sdk_sandbox_audit SELinux domain
Bug: 295861450
Test: atest CtsSdkSandboxInprocessTests and adb shell ps -Z
Change-Id: I9c5873181c925c6b8ebb411328d30aa519053acf
2023-10-26 08:50:26 +00:00
Alex Xu
902a010aaa Add sepolicy for security_state service.
security_state service manages security state (e.g. SPL) information across partitions, modules, etc.

Bug: 307819014
Test: Manual
Change-Id: I4ebcd8431c11b41f7e210947b32cf64c2adf3901
2023-10-26 06:11:58 +00:00
Tony Zhou
4ed6a0d834 Add sepolicy to allow OT daemon to write to statsd
Bug: 230565248

Test: push data to statsd_testdrive and it works now

Change-Id: I48c3affdd1fbd62df5b8eaff9908c5f3bbeda4d8
2023-10-26 05:47:01 +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
Steven Moreland
012b954125 Merge "binderfs neverallows" into main 2023-10-26 00:07:44 +00:00
Inseob Kim
d1401b7a2f Use Soong-processed files for file_contexts.bin
This should be no-op but will be useful when we implement Trunk Stable
aware contexts. Also this removes complexity from Android.mk.

Bug: 306563735
Test: build
Change-Id: Ie7e2c2c8c1e813af0ea617a2e29589b660c1bdaf
2023-10-25 23:51:44 +09:00
Steven Moreland
0365329dad binderfs neverallows
Add neverallow reading these files because this came
up in a review recently, and they contain information
about processes which is important for security, so
we'd like to avoid accidentally granted these
permissions.

Fixes: 306036348
Test: build (is build time change)
Change-Id: I8b8917dacd2a65b809b7b6fb7c1869a3db94156b
2023-10-25 00:41:25 +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
Nate Myren
0e15f2d9c5 Add appcompat override files and contexts to SELinux
This also allows the zygote to bind mount the system properties

Bug: 291814949
Test: manual
Change-Id: Ie5540faaf3508bc2d244c952904838d56aa67434
2023-10-23 18:34:12 +00:00
Arun Johnson
dae1783848 To allow drm_clear_key_aidl hal to access mediacodec
Bug: 305163559
Change-Id: Iad16fd34c0b8f7071b43ae7fc19215319c8c9d82
2023-10-23 17:10:28 +00:00
Thiébaud Weksteen
3a102a13f3 Validate private/file_contexts against plat_file_contexts_test
This tests the original private/file_contexts and not the built version
(as it may contain the overlay files or asan entries). This ensures that
all the rules in the base files are used.

Another test will be later added to validate the built version (but
without requiring that all rules are used).

Bug: 299839280
Test: mm
Change-Id: I5efdde3c7f5211472cd9a0cf8def243aef640825
2023-10-23 16:10:28 +11:00
Thiébaud Weksteen
29104da749 Add test entries for /metadata/repair-mode
Bug: 299839280
Test: mm
Change-Id: I2df9a3d65d622149ea9d5df9d4a6ff1e20071cae
2023-10-23 16:10:28 +11:00
Thiébaud Weksteen
b6e7430dad Accept test_data attribute for file_contexts_test
If file_contexts_test is given a test_data attribute, it will use
`checkfc -t` to validate the file_context against it, instead of using
the policy. Both options are mutually exclusive.

Bug: 299839280
Test: m
Change-Id: I3f541e0d0bb5d03ed146e27d67bc811cda3164b1
2023-10-23 16:10:18 +11:00
Thiébaud Weksteen
a8bcaec228 Merge changes I3a6f9db9,Ifb4453d0,I33d88b42 into main
* changes:
  Refactor contextsTestModule
  Fix private/file_contexts entry order
  checkfc: validate that all rules are matching
2023-10-23 04:06:09 +00:00
Thiébaud Weksteen
f66e1460b1 Merge "Create sepolicy for allowing system_server rw in /metadata/repair-mode" into main 2023-10-23 04:05:46 +00: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
Treehugger Robot
ea39eb6636 Merge "Add a sysprop to specify game default frame rate" into main 2023-10-23 01:12:53 +00:00
Thiébaud Weksteen
a69e14f342 Refactor contextsTestModule
Keep the type of context and decides on the flags within
GenerateAndroidBuildActions. This is a no-op but will help supporting
other options for checkfc.

Bug: 299839280
Test: mm
Change-Id: I3a6f9db9d890e0a0ccb3eca37c01b2977fa2e2d1
2023-10-23 11:21:58 +11:00
Thiébaud Weksteen
9c2a967114 Fix private/file_contexts entry order
Add test entries for property_service_for_system and virtual_camera.

Re-order file_contexts so that /data/vendor/tombstones/wifi and
/data/misc/perfetto-traces/bugreport are labelled correctly.

Bug: 299839280
Test: checkfc -t ./private/file_contexts ./contexts/plat_file_contexts_test pass
Change-Id: Ifb4453d02327b5cf678e6a4cd927b5df0960086b
2023-10-23 10:51:11 +11:00
Thiébaud Weksteen
09021255b6 checkfc: validate that all rules are matching
For the file backend, libselinux keeps track of which rules has matched.
Set up the callback and capture any log message from selinux_stats. If,
at least one rule has not been used, exit with the status code 1.

Bug: 299839280
Test: checkfc -t ./private/file_contexts ./tests/plat_file_contexts_test
Change-Id: I33d88b4234756cd13e29c5c8c081d97b6590810e
2023-10-23 10:51:11 +11:00
Li Li
87fa0f9f77 Merge "Allow system server read binderfs stats" into main 2023-10-20 23:57:19 +00:00
Wonsik Kim
c1ed17561c Merge "property_context: add Codec2 HAL selection property" into main 2023-10-20 23:08:29 +00: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
Nate Myren
8dff040569 Revert "Suppress a denial on VM boot"
This reverts commit faa538dbfc.

Reason for revert: aosp/2786963 implements the correct SEPolicy
Test: atest MicrodroidHostTests
Fixes: 306516077

Change-Id: Ia7e6db4ee4f7fa870093a34d1b8fde96d9e9b80a
2023-10-20 19:14:26 +00:00
Vadim Caen
2892de504d Merge "Add sepolicy entry for read only virtual camera property" into main 2023-10-20 12:21:25 +00:00
Alan Stokes
faa538dbfc Suppress a denial on VM boot
The denial is correct, but is causing test failures. However it
appears to be harmless and VMs are operating just fine.

Suppress it until the correct policy is ready.

Bug: 306516077
Test: atest MicrodroidHostTests
Change-Id: I5d8545add4927c2521c3d4e9dc2b5bedb91c0f45
2023-10-20 10:59:52 +01:00
Andy Yu
bdcf0bd5de Add a sysprop to specify game default frame rate
Introduce a new sysprop
`ro.surface_flinger.game_default_frame_rate_override`
to set the default frame rate for games.

Bug: 286084594
Change-Id: Ifdbf5bc9621976a0583df49eb9531de1c423385b
Test: N/A
2023-10-19 22:43:32 +00:00
Vadim Caen
1b11440f56 Add sepolicy entry for read only virtual camera property
Test: N/A
Bug: b/270352264
Change-Id: I7ee2873eadf7eba3f0f5eda340c88b6f6995ff3d
2023-10-19 22:17:18 +02:00
Treehugger Robot
c5509a8ea0 Merge "Policy for virtual_camera native service" into main 2023-10-18 15:55:42 +00:00
Bruno BELANYI
2cc14046c1 Merge "Define SurfaceFlinger HDR priming opt-in sysprop" into main 2023-10-18 09:46:36 +00:00
Thiébaud Weksteen
293b3bcce7 Track access from platform_app to system_data_file
avc: denied { search } for comm="ll.splashworker" name="10" dev="dm-69" ino=4225 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:system_data_file:s0:c522,c768 tclass=dir permissive=0 app=com.android.systemui

Test: boot and check logs
Bug: 306090533
Bug: 303581276
Change-Id: I9a3ebe68e471a36a601054c7130c474aed8bb183
2023-10-18 17:36:36 +11:00
Wonsik Kim
c6decd4a8d property_context: add Codec2 HAL selection property
Bug: 251850069
Test: run the example service and verify the selection works
Change-Id: I8b56e1f716a9dc06019232cd2c5061ccaa1951d0
2023-10-17 14:13:37 -07:00
Eric Biggers
f53eb06fd3 Merge changes Ie6c7b17a,I35d9ea22 into main
* changes:
  Stop granting permission to get_state of keystore2
  Stop granting permissions on keystore_key class
2023-10-17 18:02:44 +00:00
Thiébaud Weksteen
06a5f9ad21 Merge "Add checkfc mode to validate file_contexts against test data" into main 2023-10-17 08:25:45 +00:00
Thiébaud Weksteen
9a924ba875 Add checkfc mode to validate file_contexts against test data
A new mode for checkfc is introduced (-t) which takes a file_contexts
and a test data file. Each line in the test data file contains a path
and the expected type. checkfc loads the file_contexts and repeatedly
calls selabel_lookup(3) to verify that the computed type is as expected.

This mode can be used to confirm that any modification to file_contexts
or its build process is benign.

A test data file (plat_file_contexts_test) is added. This file was
manually created based on private/file_contexts. Each static path was
copied as-is. Each regular expression was expanded into a couple of
entries. For instance, /dev/adf[0-9]* generated /dev/adf, /dev/adf0 and
/dev/adf123.

libselinux keeps track of which specification is being hit when using
selabel_lookup. When calling selabel_stats(3), the file backend will
output a warning if a specification has not been used. This can be
leveraged to ensure that each rule is at least hit once. This property
will be leveraged in a follow-up change (by running the test as part of
the build process), to ensure that the plat_file_contexts_test file
remains up-to-date (that is, when an entry is added to
private/file_contexts, the build will fail unless a test is also added
to plat_file_contexts_test to exercice the specification/regular
expression).

Test: m checkfc && checkfc -t ./private/file_contexts ./tests/plat_file_contexts_test
Bug: 299839280
Change-Id: Ibf56859a16bd17e1f878ce7b0570b2aead79c7e0
2023-10-17 15:43:06 +11: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
Treehugger Robot
d05c1e4943 Merge "Update hal_evs_default policy" into main 2023-10-16 22:18:18 +00:00
Treehugger Robot
f604b91706 Merge "Allow artd to reopen its own memfd." into main 2023-10-16 21:01:44 +00:00
Roshan Pius
13b56467fa Merge "sepolicy: Rename NFC apex package name" into main 2023-10-16 18:31:02 +00:00
Bruno BELANYI
d350de16ae Define SurfaceFlinger HDR priming opt-in sysprop
Bug: 295257834
Test: manual - check that the sysprop can be defined after applying
Change-Id: I3be32ba76cf97d50c56f2dde0aeafb937b530508
2023-10-16 16:27:54 +00:00
Thiébaud Weksteen
51cc740ca8 Ignore access from priv_app to wifi_config_prop
Bug: 303581276
Bug: 291197167
Bug: 208360714
Bug: 208919128
Test: presubmit
Change-Id: Ia0750d39d7c1d666f2f5d58f4c16169b5348d32f
2023-10-16 11:00:24 +11:00
Jiakai Zhang
4d70f0bf4b Allow artd to reopen its own memfd.
Bug: 257532944
Test: atest CtsCompilationTestCases
Change-Id: I6e2a04fe2b9145aebd7db4d6a0d1ac560eddb66b
2023-10-13 18:26:56 +00:00
Dennis Shen
72da88530f Merge "add next_boot_prop SELinux context to store staged sys prop" into main 2023-10-13 18:22:56 +00:00
Roshan Pius
b013422f8f sepolicy: Rename NFC apex package name
To avoid clash with existing com.android.nfc package of NFC app.

Bug: 303286040
Test: Compiles
Merged-In: I1474146312b7131ac847aad23e1a71e24351d750
Change-Id: I1474146312b7131ac847aad23e1a71e24351d750
2023-10-13 18:04:49 +00:00
Vadim Caen
f6e88ec70a Policy for virtual_camera native service
Change-Id: Id0c582f9259ffd056b22f111d7e81bc061c2371d
2023-10-13 16:42:11 +02:00
Changyeon Jo
561930c06b Update hal_evs_default policy
- Allow to access writable graphics properties.
- Allow to perform binder IPC.

Bug: 303581276
Test: m -j selinux_policy
Change-Id: I02c8ccd416172e5f6c17eff6573137dd4a8147c7
2023-10-12 20:31:07 +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
Jiakai Zhang
b6a3360ea3 Merge "Allow profman to read from memfd created by artd." into main 2023-10-12 14:59:38 +00:00
Jiakai Zhang
8ff6c55fc4 Allow profman to read from memfd created by artd.
Bug: 257532944

Change-Id: I13a953c533b1789eb06158a5ffa227fa986870fc
2023-10-12 13:48:00 +00:00