SE Linux Android 9 AOSP:在system / sepolicy / private / untrusted_app.te文件中添加权限导致构建失败

问题描述

我正在使用 Android9 AOSP ,当我在untrusted_app.te(位于#! /bin/bash set -euo pipefail IFS=$'\n\t' function log_step() { echo -e "\n\e[96m${*}\e[0m" } # Delegates the call to the merge strategy and passing args # You can uncomment the desired strategy function merge() { # merge_simple $* merge_squash_rename $* # merge_squash_no_edit $* } function merge_squash_rename(){ echo -e "\e[94mMerge ${1} into ${2}\e[0m" git checkout ${2} git merge --squash ${1} git commit -m "Merge ${1} into ${2}" } function merge_squash_no_edit(){ echo -e "\e[94mMerge ${1} into ${2}\e[0m" git checkout ${2} git merge --squash ${1} git commit --no-edit } function merge_simple(){ echo -e "\e[94mMerge ${1} into ${2}\e[0m" git checkout ${2} git merge ${1} } tmp_dir=$(mktemp -d -t strategit-XXXXXXXX) echo "Created directory ${tmp_dir}" cd ${tmp_dir} # Initial state : a file named hello.txt,containing "1,2,3" log_step "Create initial file with 1,3" git init echo '1,3' >> hello.txt git add hello.txt git commit -m 'First commit' # Create initial branches release + develop log_step "Create branches release and develop" git checkout -b release git checkout -b develop # Work on ticket FW-456 on release log_step "Create PR on release in order to add the line 4,5,6" git checkout release git checkout -b feature/FW-456 echo '4,6' >> hello.txt git add hello.txt git commit -m 'feature/FW-456' # Keep it for cherry-pick later ORIGINAL_COMMIT_HASH=$(git rev-parse HEAD) log_step "Merge the PR on release" merge feature/FW-456 release # report PR on develop by creating a report branch log_step "Create the report branch from develop" git checkout develop git checkout -b report/feature/FW-456 git cherry-pick ${ORIGINAL_COMMIT_HASH} log_step "Merge the report branch on develop" merge report/feature/FW-456 develop # Work on ticket FW-789 on develop log_step "Create a new PR from develop to add the line 7,8,9" git checkout develop git checkout -b feature/FW-789 echo '7,9' >> hello.txt git add hello.txt git commit -m 'feature/FW-789' log_step "Merge the PR in develop" merge feature/FW-789 develop # Now,report release into develop log_step "Create a PR on develop to report release in develop" git checkout develop git checkout -b chore/report-release-into-develop # "|| true" to prevent script from exiting because of the potential conflict error log_step "Try to merge" git merge release || true echo "" echo "***************************************************" echo "* *" echo -e "* See result in directory \e[92m${tmp_dir}\e[0m *" echo "* *" echo "***************************************************" 中)中添加权限时,构建失败。

错误:

system/sepolicy/private/untrusted_app.te

要添加的权限为system/sepolicy/private/untrusted_app.te:27:ERROR 'unknown type xyz_block_device' at token ';' on line.... 在文件系统/sepolicy/private/untrusted_app.te

任何人都可以指导我在哪里定义xyz_block_device,谢谢!

解决方法

看到错误的原因是未定义xyz_block_device。为此,您需要进入file_contexts并定义您的xyz_block_device,如下所示:

/dev/yourblockdevice  u:object_r:block_device:s0

,然后您可以将规则添加到untrusted_app.te。

注意:我不得不提到不建议更改系统SEPolicy也不安全,最好将名为untrusted_app.te的文件添加到目标树中。 (/设备/供应商/型号)。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...