Skip to content
Snippets Groups Projects
Commit 939d16b5 authored by Sandeep Patil's avatar Sandeep Patil
Browse files

service_contexts: label service_contexts explicitly


The label applies to all service_contexts regardless of their location.
This also lets us track the service_contexts usage and limit access to
the files for the corresponding object manager alone.

Bug: 36002427
Test: Boot sailfish and observe no denials for 'serice_contexts'
Test: cts-tradefed run singleCommand cts --skip-device-info \
          --skip-preconditions --skip-connectivity-check \
          --abi arm64-v8a --module CtsSecurityHostTestCases \
          -t android.security.cts.SELinuxHostTest#testAospServiceContexts

Change-Id: I97fc8b24bc99ca5c00d010fb522cd39a35572858
Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
parent 54a42001
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,7 @@ allow adbd system_file:file r_file_perms;
allow adbd selinuxfs:dir r_dir_perms;
allow adbd selinuxfs:file r_file_perms;
allow adbd kernel:security read_policy;
allow adbd service_contexts_file:file r_file_perms;
allow adbd surfaceflinger_service:service_manager find;
allow adbd bootchart_data_file:dir search;
......
......@@ -50,8 +50,8 @@
/nonplat_seapp_contexts u:object_r:rootfs:s0
/plat_seapp_contexts u:object_r:rootfs:s0
/sepolicy u:object_r:rootfs:s0
/plat_service_contexts u:object_r:rootfs:s0
/nonplat_service_contexts u:object_r:rootfs:s0
/plat_service_contexts u:object_r:service_contexts_file:s0
/nonplat_service_contexts u:object_r:service_contexts_file:s0
##########################
# Devices
......@@ -250,12 +250,14 @@
/system/bin/vr_wm u:object_r:vr_wm_exec:s0
/system/bin/hw/android\.hidl\.allocator@1\.0-service u:object_r:hal_allocator_default_exec:s0
/system/etc/selinux/plat_property_contexts u:object_r:property_contexts_file:s0
/system/etc/selinux/plat_service_contexts u:object_r:service_contexts_file:s0
#############################
# Vendor files
#
/vendor(/.*)? u:object_r:system_file:s0
/vendor/etc/selinux/nonplat_property_contexts u:object_r:property_contexts_file:s0
/vendor/etc/selinux/nonplat_service_contexts u:object_r:service_contexts_file:s0
#############################
# OEM and ODM files
......
......@@ -259,6 +259,9 @@ type gps_control, file_type;
# property_contexts file
type property_contexts_file, file_type;
# service_contexts file
type service_contexts_file, file_type;
# Allow files to be created in their appropriate filesystems.
allow fs_type self:filesystem associate;
allow sysfs_type sysfs:filesystem associate;
......
......@@ -11,7 +11,8 @@ type servicemanager_exec, exec_type, file_type;
allow servicemanager self:binder set_context_mgr;
allow servicemanager { domain -init }:binder transfer;
r_dir_file(servicemanager, rootfs)
# Access to all (system and vendor) service_contexts
allow servicemanager service_contexts_file:file r_file_perms;
# Check SELinux permissions.
selinux_check_access(servicemanager)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment