Android SELinux的avc: denied log是哪里打印的及关闭 某些场景下并不需要打开SELinux,也就是SELinux设为Permissive,但如果程序设计不符合SELinux sepolicy, 日志中会频繁打印 如下类似avc: denied的log [24.018396] type=1400audit(1622165470.867:666): avc: denied { read }forpid=2358comm="testagent"name="Ap...
avc: denied { write } for pid=1 comm="init" name="export" dev="sysfs" ino=3486 scontext=u:r:init:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0 allow system_app protect_f_data_file:dir audit2allow -i avc.txt > avc.te 运行audit2allow工具(external/selinux/prebuilts/b...
1. 确认 seLinux导致权限问题 1.1 标志性log 格式: avc: denied { 操作权限 } for pid=7201 comm=“进程名” scontext=u:r:源类型:s0 tcontext=u:r:目标类型:s0 tclass=访问类别 permissive=0 1.2 举例: Kenel log: avc: denied { execheap } for pid=7201 comm="com.baidu.input" scontext=u:r...
audit(0.0:67): avc: denied { write } for path="/dev/block/vold/93:96" dev=“tmpfs” ino=1263 scontext=u:r:kernel:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file permissive=0 可以看到有avc denied,且最后有permissive=0,表示不允许。 3. 具体案例分析 解决原则是:缺什么权限补什...
logcat | grep avc 这么做的目的是为了能够在app报错时及时发现avc权限问题。例如,在app中通过接口对节点进行读写操作时发现了log报以下selinux avc权限错误: type=1400 audit(0.0:875): avc: denied { read } for name="value" dev="sysfs" ino=29545 scontext=u:r:system_server:s0 tcontext=u:object...
如何使用SeLinux 示例我们查看一段日志记录:avc: denied { read } for pid=1494 comm=“sdcard” name=“0” dev=“nandk” ino=2452scontext=u:r:sdcardd:stcontext=u:object_r:system_data_file:stclass=dir permissive=从日志中可以看出,有一个进程(pid=1494,comm=“sdcard”)试图读取一个文件(...
对于Selinux,如果只是解决权限问题,不需要去理解那么多理论,按下面模板处理即可。但请注意,在enforce模式下,报错是不会有打印产生的,所以先要将selinux设置为Permissive才行。 一、标签模板 1.1 报错模板 avc: denied { read write getattr } for pid=3944 comm="handsetpowerlib" name="xxxx" dev="tmpfs" ino...
selinux权限添加相关: 将所有avc相关log拷贝到avc.txt中,将avc.txt拷贝到相关项目根目录下,执行audit2allow -i avc.txt会生成相应的权限语句; 3.查看安全上下文scontext:属于什么te 查看进程(APP):ps -Z 查看文件:ls -Z AVC LOG分析 示例: I auditd : type=1400 audit(0.0:4720): avc: denied { write...
在Android开发的过程中,遇到关于selinux相关的东西,当时还一下子看不懂,现在好像有点眉目了。 比如,内核打印这个提示 type=1400 audit(32.939:25): avc: denied {open} for pid=2592 comm=”chmod” path=”/dev/block/mmcblk0p25″ dev=”tmpfs” ino=6494 scontext=u:r:init_shell:s0 tcontext=u:ob...
I/SELinux ( 0): avc: denied {read} app_process:app_data_file 复制代码 这表示发生了权限违规。要禁用SELinux审计日志,只需将setenforce命令的值更改为0: adb shell setenforce 0 复制代码 使用Android Studio的Logcat: 如果您使用的是Android Studio,可以直接在IDE中查看权限违规日志。运行您的应用程序,并在...