天天看點

android apk權限 linux,Android SeLinux權限問題和解決方法

目标類型”

如:在file_contexts中添加:/dev/tfa9890u:object_r:audio_device:s0

3.4 舉例

添權重限:

在mediaserver.te中添加allow mediaserver device:chr_file { read write open};

編譯報錯:

libsepol.check_assertion_helper: neverallow on line 258 ofexternal/sepolicy/domain.te (or line 5252 of policy.conf) violated byallow mediaserver device:chr_file { read write open};

違反了domain.te 258的:

neverallow {domain –unconfineddomain –ueventd } device:chr_file { open read write}

運作Log:

avc: denied { read write } for pid=303 comm=”mediaserver”name=”tfa9890″ dev=”tmpfs” ino=3880 scontext=u:r:mediaserver:s0 tcontext=u:object_r:device:s0tclass=chr_file permissive=0

修改步驟:

1.目标名稱是: tfa9890, 其在系統中的路徑是: /dev/tfa9890, 是audio相關的裝置檔案

2.源類型是mediaserver, 在mediaserver.te 檔案中發現其具有 audio_device 目标類型的權限

3.是以在file_contexts 中添加 “/dev/tfa9890 u:object_r:audio_device:s0” 可以解決問題