写了一个简单的helloworld程序作为一个服务,运行后出现各种avc权限问题,如open(/dev/tty*)设备返回-1,log如下:
01-01 11:47:51.200 1714 1714 W helloworld: type=1400 audit(0.0:96): avc: denie
d { read write } for name="ttyVCOM0" dev="tmpfs" ino=3390 scontext=u:r:helloworl
d:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=0
解决办法:
在helloworld.te中添加
allow helloworld device:chr_file rw_file_perms;
本文介绍了一个简单的HelloWorld程序作为服务运行时遇到的AVC权限问题,特别是open(/dev/tty*)设备返回-1的情况。通过在HelloWorld.te文件中添加特定权限解决了这一问题。
2200

被折叠的 条评论
为什么被折叠?



