我在Android-N中看到了以下sepolicy错误。
W Binder:3929_E: type=1400 audit(0.0:29): avc: denied { write } for path="/dev/ttyGS0" dev="tmpfs" ino=73461 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:serial_ic:s0 tclass=chr_file permissive=0
我创建了目录" vendor / qcom / sepolicy / acm /"并在BoardConfig.mk中输入,如下所示。
# ACM features belong in vendor/qcom/sepolicy
BOARD_SEPOLICY_DIRS := vendor/qcom/sepolicy/acm
我也评论过" device / qcom / sepolicy / common / file_contexts"
-/dev/ttyGS0 u:object_r:gadget_serial_device:s0
+#/dev/ttyGS0 u:object_r:gadget_serial_device:s0
我在以下目录中更改了sepolicy:
[1] vendor / qcom / sepolicy / acm / file_contexts
# These are the ports used to talk.
# We have to relabel these because domain.te has never allow rules that prevent
# any other domain (other than init or ueventd) from accessing these files
/dev/ttyGS0 u:object_r:serial_ic:s0
[2] vendor / qcom / sepolicy / acm / file.te
type serial_ic, dev_type, fs_type;
[3] vendor / qcom / sepolicy / acm / platform_app.te
allow platform_app serial_ic:chr_file { ioctl open read write };
[4] vendor / qcom / sepolicy / acm / system_server.te
#allow for acm node
allow system_server serial_ic:chr_file rw_file_perms;
[5] vendor / qcom / sepolicy / acm / untrusted_app.te
# for serial chat app
allow untrusted_app serial_ic:chr_file ioctl;
allow untrusted_app serial_ic:chr_file { read write };
[6] vendor / qcom / sepolicy / acm / system_app.te
#allow acm node
allow system_app serial_ic:chr_file { ioctl open read write};
仍然我无法解决"写" sepolicy错误。无论何时从我的串行聊天应用程序,它都会尝试访问节点" / dev / ttyGS0"应用程序崩溃。
发布日志以供参考
--------- beginning of crash
01-01 07:11:46.954 15292 15292 E AndroidRuntime: FATAL EXCEPTION: main
01-01 07:11:46.954 15292 15292 E AndroidRuntime: Process: com.android.serialchat, PID: 15292
01-01 07:11:46.954 15292 15292 E AndroidRuntime: DeadSystemException: The system died; earlier logs will point to the root cause
01-01 07:11:46.960 3929 8483 W ActivityManager: Force finishing activity com.android.serialchat/.SerialChat
01-01 07:11:46.965 3929 8483 D ActivityTrigger: ActivityTrigger activityPauseTrigger
01-01 07:11:46.949 8597 8597 W Binder:3929_E: type=1400 audit(0.0:29): avc: denied { write } for path="/dev/ttyGS0" dev="tmpfs" ino=73461 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:serial_ic:s0 tclass=chr_file permissive=0