How to fix SELinuxHostTest#testNoBugreportDenials fail

问题描述

 收到CTS 测试fail报告,如:
Module Passed Failed Assumption Failure Ignored Total Tests Done
armeabi-v7a CtsSecurityHostTestCases 0 1 0 0 1 true


armeabi-v7a CtsSecurityHostTestCases
Test Result Details
android.security.cts.SELinuxHostTest#testNoBugreportDenials
fail
junit.framework.AssertionFailedError: Found illegal SELinux denial(s): avc: denied { getattr } for path="/mnt/expand" dev="tmpfs" ino=1586 scontext=u:r:dumpstate:s0 tcontext=u:object_r:mnt_expand_file:s0 tclass=dir permissive=0
这是因为从Android Q开始 Google 新增了对dumpstate denials 的检查(AOSP/667966, AOSP/742461), 如果在执行Bugreport命令后,有出现dumpstate 的avc denied log,该测项就会fail.
 
Add CTS test to ensure bugreports don't generate SELinux denials.

This test takes a bugreport on the device and ensures that it does not
generate any dumpstate-related denials.
 
/cts/hostsidetests/security/src/android/cts/security/SELinuxHostTest.java
953   public void testNoBugreportDenials() throws Exception {
954   // Take a bugreport and get its logcat output.
955   mDevice.executeAdbCommand("logcat", "-c");
956   mDevice.getBugreport();
957   String log = mDevice.executeAdbCommand("logcat", "-d");
958   // Find all the dumpstate-related types and make a regex that will match them.
959   Set types = sepolicyAnalyzeGetTypesAssociatedWithAttribute("hal_dumpstate_server");
960   types.add("dumpstate");
961   String typeRegex = types.stream().collect(Collectors.joining("|"));
962   Pattern p = Pattern.compile("avc: *denied.*scontext=u:(?:r|object_r):(?:" + typeRegex + "):s0.*");
963   // Fail if logcat contains such a denial.
964   Matcher m = p.matcher(log);
965   StringBuilder errorString = new StringBuilder();
966   while (m.find()) {
967   errorString.append(m.group());
968   errorString.append("\n");
969   }
970   assertTrue("Found illegal SELinux denial(s): " + errorString, errorString.length() == 0);
971   }
 
dumpstate 作为AOSP自带的process,我们一般不会改到它的源码。此类问题的出现,一般是因为新增了一些目录/文件,而没有给dumpstate添加allow rules 或者dontaudit rules, 操作有被触发时就会出现avc denied log,引起测项fail。

解决方案

继续阅读“How to fix SELinuxHostTest#testNoBugreportDenials fail”

[VTSR3]vendor.mediatek.hardware.presence@1.0::IPresence not available.

问题描述

04-03 12:55:16 I/ModuleListener: [9/9] VtsTrebleVendorVintfTest#DeviceManifest/SingleManifestTest.InterfacesAreReleased/0_32bit fail:
test/vts-testcase/hal/treble/vintf/SingleManifestTest.cpp:51
Failed
vendor.mediatek.hardware.presence@1.0::IPresence not available.
test/vts-testcase/hal/treble/vintf/SingleManifestTest.cpp:51
Failed
vendor.mediatek.hardware.presence@1.0::IPresence not available.

解决方案

继续阅读“[VTSR3]vendor.mediatek.hardware.presence@1.0::IPresence not available.”

[VTS10R3]VtsFastbootVerification

问题描述

VtsFastbootVerification
VtsFastbootVerification#testFastbootReboot fail:
VtsFastbootVerification#testFastbootdSlotOperations
VtsFastbootVerification#testLogicalPartitionCommands
VtsFastbootVerification#testLogicalPartitionFlashing
Unknown error: test case requested but not executed.

解决方案

继续阅读“[VTS10R3]VtsFastbootVerification”

[CTSVR3][its test][scene3][camera1]scene3/test_3a_consistency FAIL

问题描述

 [its test][scene3][camera1]scene3/test_3a_consistency FAIL

该题原因是AE init清空m_u4Hbinwidth、m_u4Hbinheight再赋值的过程中,上层下了setAEMeteringArea(),m_u4Hbinwidth、m_u4Hbinheight为0导致Area计算错误,最终AE收敛发生变化的问题。

Its LOG一般可以看到三次的曝光设定差异太大导致的fail:

继续阅读“[CTSVR3][its test][scene3][camera1]scene3/test_3a_consistency FAIL”