Tests on the Android5.1
1, android.security.cts.selinuxdomaintest# Testinitdomain fail
The printed log
This is the typical L version of the SELinux Test problem.
Android.security.cts.SELinuxDomainTest has 1 fail,
--Testinitdomain
junit.framework.AssertionFailedError:Expected 1 process in SELinux domain "U:R:INIT:S0" Found "[PID:" 1 "proctitle:"/ini T "label:" U:r:init:s0 "vsize:1327104, pid:" 298 "Proctitle:"/system/bin/immvibed "Label:" U:r:init:s0 "vsize:1765376]" Expected:<1> but was:<2> at Junit.framework.Assert.fail (assert.java:50)
The key reason is that Google emphasizes that the SELinux Context of the system's critical processes must be unique, and that system-critical processes include Init, vold, Surfaceflinger, netd, ServiceManager, Drmserver, and so on. When multiple process is found using these critical domain, SELinux Test fail.
For this reason, a system-critical process starts a long-running process, and domain switching is required. Otherwise, you will not be able to pass Google CTS test.
A typical scenario is to start a service with init without a domain switch to the service. For example, the problem of your company SUNTROLD_32 this service did not go to domain switching, and failed to pass the test.
Here is a simple demo.
Scenario: Define an init-initiated service, Demo_service, and the corresponding execution file is/system/bin/demo.
(1). Create a demo.te in the/device/mediatke/common/sepolicy directory, and then in/device/mediatke/common/boardconfig.mk board_sepolicy_ New Demo.te in UNION macro
(2). Define the demo type, init start service type conversion, Demo.te
Type demo, domain;
Type demo_exec, Exec_type, File_type;
Init_daemon_domain (Demo)
(3). Binding execution File File_context type
/system/bin/demo U:object_r:demo_exec:s0
(4). Define additional permissions in Demo.te according to the files and devices that the demo needs to access.
A typical scenario is to start a service with init without a domain switch to the service. For example, in this problem immvibed the service does not have domain switchover, so it cannot pass the test. Just follow the demo to modify it.
Android CTS Test Fail Item Revision summary (IV)