ANDR-PERF tryGetService 失败; SELinux

Posted

技术标签:

【中文标题】ANDR-PERF tryGetService 失败; SELinux【英文标题】:ANDR-PERF tryGetService failed; SELinux 【发布时间】:2019-07-27 01:29:39 【问题描述】:

每次我在设备上启动我的应用程序时,我都会在日志中看到此错误。

E/ANDR-PERF:IPerf::tryGetService 失败! E/SELinux: avc: denied find for interface=vendor.qti.hardware.perf::IPerf pid=3328 scontext=u:r:untrusted_app:s0:c123,c256,c512,c768 tcontext=u:object_r:hal_perf_hwservice :s0 tclass=hwservice_manager permissive=0

我有点困惑这是什么意思。 也许是我的一个图书馆造成了这种情况?

dependencies 
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

//General Stuff
implementation "com.android.support:appcompat-v7:$compile_version"
implementation "com.android.support:support-v4:$compile_version"
implementation "com.android.support:design:$compile_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.android.support:recyclerview-v7:$compile_version"
implementation "com.android.support:cardview-v7:$compile_version"
implementation "com.android.support:exifinterface:$compile_version"

//Test
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

//Testfairy
implementation 'testfairy:testfairy-android-sdk:1.9.4'

//REST - MVVM
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'

//Location
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'

//Async Tasks
implementation "org.jetbrains.anko:anko-commons:0.10.0"

//Barcode Detector
//OCR Scanner
implementation 'com.google.android.gms:play-services-vision:17.0.2'
implementation 'com.google.zxing:core:3.3.0'

//Biometric Authentication
implementation 'com.kevalpatel2106:fingerprint-dialog-compat:1.0'

//Glide Image manager
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

//Image Viewer
implementation 'com.facebook.fresco:fresco:1.9.0'
implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'

//EditText Label Design
implementation 'com.wrapp.floatlabelededittext:library:0.0.6'

//Segmented Control
implementation 'info.hoang8f:android-segmented:1.0.6'

//Progress Bar
implementation 'com.github.ybq:Android-SpinKit:1.1.0'

//BlurView
implementation 'com.wonderkiln:blurkit:1.0.0'

//Tags
implementation 'me.gujun.android.taggroup:library:1.4@aar'

//Seek Bar
implementation 'com.ramotion.fluidslider:fluid-slider:0.3.0'

//Rating View
implementation 'com.iarcuschin:simpleratingbar:0.1.5'

//Country Code Picker
implementation 'com.hbb20:ccp:2.2.0'

【问题讨论】:

您设备的 SELinux 状态如何? (在系统设置的关于手机界面) 对不起,我不知道你是什么意思?我在系统设置的关于手机屏幕中没有看到任何关于 selinux 的信息,但它是一个带有 android 版本 9 的 oneplus 5t 【参考方案1】:

这似乎是 Blurkit 库中的一个问题。

【讨论】:

【参考方案2】:

此日志文件表示您的某个库存在访问权限(可能是 interface=vendor.qti.hardware.perf::IPerf)违规。您必须重新启动您的应用程序并找到有问题的应用程序。您也可以在

的帮助下找到
adb shell ps -eZ | grep  3328 

在您的应用同时运行时,从命令行命令有问题的服务。找到受害者(应用程序)后,您必须在 /external/sepolicy/service_contexts 文件中添加一个 SELinux 规则来处理访问冲突。

【讨论】:

感谢您的回答!它尝试了很长时间才弄清楚你的意思。你能告诉我如何添加这样的规则吗? 您应该研究一些有用的工具,例如 SETools 和 policycoreutils-python(audit2allow)。首先,您将您的 avc 拒绝日志写入日志文件。然后使用 audit2allow 获取有关您的拒绝的解决方案。之后,您有很多选择来添加正确的解决方案。你可以应用你的文件正确的域,或者你可以绕过 semanage 布尔值,或者如果没有,你可以在你的 selinux 规则文件中添加新行,编译它。解决方案完全取决于问题和您的系统配置。 最后一个问题。这是我的应用程序的错误还是其他什么?因为在其他设备上我没有这个错误 从你的笔记来看,我认为它很可能是另一个试图到达 HAL 层 perf_hwservice 的应用程序或库。您应该从我在答案中提到的命令中获取有关有问题的应用程序的信息。如果 ps -eZ 没有返回任何东西,它已经死了。 该命令的结果表明我的应用程序导致了该错误。

以上是关于ANDR-PERF tryGetService 失败; SELinux的主要内容,如果未能解决你的问题,请参考以下文章

拼多多一面热乎的面经!还是 失算了失算了

生存无法识别右删失数据

通过管道失败将结构写入孩子

R中缺失和删失数据的多重插补

Teradata 中易失性表的光标

如何在没有 SecTrustGetTrustResult 的情况下诊断 iOS 上的证书可恢复信任失​​败?