我正在尝试在我的 Poco M3 上使用 pstore 日志。我尝试了一切。 PSTORE 配置在内核上激活,pstore 模块加载到手机上,手机已 root,/sys/fs/pstore 自动安装但不包含任何内容。
130|citrus:/ # dmesg | grep pstore
[ 0.094327] console [pstore-1] enabled
[ 0.094468] pstore: Registered ramoops as persistent store backend
[ 1.065975] pstore: Using compression: deflate
[ 98.052156] type=1400 audit(1654268897.690:3752): avc: denied { read } for comm="ls" name="/" dev="pstore" ino=1197 scontext=u:r:shell:s0 tcontext=u:object_r:pstorefs:s0 tclass=dir permissive=1
[ 98.052450] type=1400 audit(1654268897.690:3753): avc: denied { open } for comm="ls" path="/sys/fs/pstore" dev="pstore" ino=1197 scontext=u:r:shell:s0 tcontext=u:object_r:pstorefs:s0 tclass=dir permissive=1
看起来selinux正在阻止/sys/fs/pstore
上的ls
。有没有办法让它始终允许/sys/fs/pstore 上的 ls
,即使在重新启动后也是如此?
我已经将 androidboot.selinux=permissive
添加到我的启动命令行中,并且它可以在手机上识别:
130|citrus:/ # getenforce
Permissive
更新:我刚刚了解到宽容意味着只记录而不阻塞,所以这不是阻塞,我的 pstore 确实是空的。我说得对吗?
最佳答案
/sys/fs/pstore 的用途非常明确 - 持久存储崩溃文件 - 内核 oops 和最后一个 RAM 控制台。因此,从某种程度上来说,它不包含任何内容实际上是件好事。
亲自看看 - 模拟 panic 。这需要将“c”写入/proc/sysrq_trigger (并且可能通过/proc/sys/kernel/sysrq 掩码启用该功能)。设备将重新启动,启动时您将看到存储文件出现。 (请注意,这必须是崩溃后立即启动,因为此后文件将被清除。
顺便说一下 - Re:SELinux,您显示的那些 AVC 日志是因为 SELinux 拒绝了“ls”操作本身。这是强制访问控制保护,可防止读取目录(即使目录为空)。所以这不会有太大改变。
关于android -/sys/fs/pstore 不适用于 poco m3 android,有办法修复吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72491923/