日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

selinux-添加

發布時間:2025/4/5 linux 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 selinux-添加 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Aispeech Audio Hal porting到android系統中需要添加如下selinux權限(android8.1): diff --git a/system/sepolicy/public/domain.te b/system/sepolicy/public/domain.te --- a/system/sepolicy/public/domain.te +++ b/system/sepolicy/public/domain.te @@ -623,6 +623,7 @@ full_treble_only(`???? -coredomain???? -netdomain???? -socket_between_core_and_vendor_violators +??? -hal_audio?? }, netd);

?

?? # Vendor domains are not permitted to initiate create/open sockets owned by core domains diff --git a/system/sepolicy/public/hal_audio.te b/system/sepolicy/public/hal_audio.te index 33330bf..e69a19b7 100644 --- a/system/sepolicy/public/hal_audio.te +++ b/system/sepolicy/public/hal_audio.te @@ -32,7 +32,7 @@ neverallow hal_audio { file_type fs_type }:file execute_no_trans;

?

?# Should never need network access. # Disallow network sockets. -neverallow hal_audio domain:{ tcp_socket udp_socket rawip_socket } *; +#neverallow hal_audio domain:{ tcp_socket udp_socket rawip_socket } *;

?

?# Only audio HAL may directly access the audio hardware neverallow { halserverdomain -hal_audio_server } audio_device:chr_file *; diff --git a/system/sepolicy/public/hal_neverallows.te b/system/sepolicy/public/hal_neverallows.te index 036e1d2..13f78aa 100644 --- a/system/sepolicy/public/hal_neverallows.te +++ b/system/sepolicy/public/hal_neverallows.te @@ -16,6 +16,7 @@ neverallow {?? -hal_wifi_server?? -hal_wifi_supplicant_server?? -rild +? -hal_audio } domain:{ tcp_socket udp_socket rawip_socket } *;

?

?###

diff --git a/device/rockchip/common/sepolicy/hal_audio_default.te b/device/rockchip/common/sepolicy/hal_audio_default.te index ebc2023..f96c83d 100644 --- a/device/rockchip/common/sepolicy/hal_audio_default.te +++ b/device/rockchip/common/sepolicy/hal_audio_default.te @@ -7,3 +7,18 @@ allow hal_audio_default hidraw_device:chr_file { open read write };

?

?set_prop(hal_audio_default,media_prop) allow hal_audio_default sysfs:file rw_file_perms; + +#for aispeech +allow hal_audio_default hal_audio_default:udp_socket { create bind write read getattr }; +allow hal_audio_default hal_audio_default:tcp_socket { create connect getopt setopt read write

name_connect }; +allow hal_audio_default audioserver_data_file:dir { add_name remove_name write search }; +allow hal_audio_default port:tcp_socket name_connect; +allow hal_audio_default audioserver_data_file:file { write open getattr create }; +allow hal_audio_default node:udp_socket node_bind; +allow hal_audio_default netd:unix_stream_socket connectto; +allow hal_audio_default fwmarkd_socket:sock_file write; +allow hal_audio_default audioserver_data_file:file unlink; + +#fixed common +#allow hal_audio_default vendor_shell_exec:file execute_no_trans; +#allow hal_audio_default su_exec:file { execute_no_trans read open getattr}; diff --git a/device/rockchip/common/sepolicy/netd.te b/device/rockchip/common/sepolicy/netd.te index 3acb9a6..34f814f 100644 --- a/device/rockchip/common/sepolicy/netd.te +++ b/device/rockchip/common/sepolicy/netd.te @@ -9,3 +9,7 @@ allow netd netd:netlink_scsitransport_socket { create setopt bind write read get allow netd netd:netlink_rdma_socket { create setopt bind write read getopt getattr }; allow netd netd:netlink_crypto_socket { create setopt bind write read getopt getattr };

?

+#for aispeech +allow netd hal_audio_default:tcp_socket { setopt getopt read write}; +allow netd hal_audio_default:udp_socket { setopt getopt read write}; +allow netd hal_audio_default:fd { use }; 說明:以上修改可以過selinux驗證,但是有修改系統默認selinux權限,無法過CTS某些測試。 見下面: armeabi-v7a CtsSecurityHostTestCases Test Result Details

android.cts.security.SELinuxNeverallowRulesTest# testNeverallowRules56 fail

junit.framework.AssertionFailedError: The following errors were encountered when validating the SELinuxneverallow rule:

?

使用腳本添加selinux

2.2.2Selinux 添加方法
Selinux 在 Android5.1 之后被真正的引入到 android 系統之中。目前在 Android8.0 及以上 系統常見 selinux 處于打開狀態。詳細的 Selinux 規則此處不再描述。Selinux 規則可以根據 log 中的提示信息進行添加。以 AispeechAudioHal 為例,開機之后可以通過 grep logcat 獲取 selinux 的警告信息。命令如下: logcat|grepavc 或者 logcat |grepdenied 從 log 中再篩選出 audioserver 相關的 log,部分如下所示: 7 04-15 16:11:41.440 316 316 I Auth : type=1400 audit(0.0:9): avc: denied { read } for name="address" dev="sysfs" ino=14731 scontext=u:r:audioserver:s0 tcontext=u:object_r:sysfs:s0tclass=file permissive=1 8 04-15 16:11:41.440 316 316 I Auth : type=1400 audit(0.0:10): avc: denied { open } for path="/sys/devices/platform/fe300000.ethernet/net/eth0/address" dev="sysfs" ino=14731 scontext=u:r:audioserver:s0 tcontext=u:object_r: sysfs:s0 tclass=file permissive=1 9 04-15 16:11:41.443 316 316 I Auth : type=1400 audit(0.0:11): avc: denied { getattr } for path="/sys/devices/platform/fe300000.ethernet/net/eth0/address" dev="sysfs" ino=14731 scontext=u:r:audioserver:s0 tcontext=u:object _r:sysfs:s0 tclass=file permissive=1 10 04-15 16:11:41.460 316 316 I Auth : type=1400 audit(0.0:12): avc: denied { create } for scontext=u:r:audioserver:s0 tcontext=u:r:audioserver:s0 tclass=udp_socket permissive=1
11 04-15 16:11:41.460 316 316 I Auth : type=1400 audit(0.0:13): avc: denied { bind } for scontext=u:r:audioserver:s0 tcontext=u:r:audioserver:s0 tclass=udp_socket permissive=1 12 04-15 16:11:41.460 316 316 I Auth : type=1400 audit(0.0:14): avc: denied { node_bind } for saddr=127.0.0.1 scontext=u:r:audioserver:s0 tcontext=u:object_r:node:s0 tclass=udp_socketpermissive=1 13 04-15 16:11:41.460 316 316 I Auth : type=1400 audit(0.0:15): avc: denied { getattr } for laddr=127.0.0.1 lport=42108 scontext=u:r:audioserver:s0 tcontext=u:r:audioserver:s0tclass=udp_socketpermissive=1 14 04-15 16:11:41.460 316 316 I Auth : type=1400 audit(0.0:16): avc: denied { write } for name="fwmarkd" dev="tmpfs" ino=16490 scontext=u:r:audioserver:s0 tcontext=u:object_r:fwmarkd_socket:s0tclass=sock_file permissive=1 15 04-15 16:11:41.460 316 316 I Auth : type=1400 audit(0.0:17): avc: denied { connect } for scontext=u:r:audioserver:s0 tcontext=u:r:audioserver:s0 tclass=udp_socket permissive=1 16 04-15 16:11:41.466 316 316 I Auth : type=1400 audit(0.0:18): avc: denied { write } for scontext=u:r:audioserver:s0 tcontext=u:r:audioserver:s0 tclass=udp_socket permissive=1 17 04-15 16:11:51.483 316 316 I Auth : type=1400 audit(0.0:19): avc: denied { create } for scontext=u:r:audioserver:s0 tcontext=u:r:audioserver:s0 tclass=tcp_socket permissive=1 18 04-15 16:11:51.483 316 316 I Auth : type=1400 audit(0.0:20): avc: denied { write } for name="fwmarkd" dev="tmpfs" ino=16490 scontext=u:r:audioserver:s0 tcontext=u:object_r:fwmarkd_socket:s0tclass=sock_file permissive=1 19 04-15 16:11:51.483 316 316 I Auth : type=1400 audit(0.0:21): avc: denied { connectto } for path="/dev/socket/fwmarkd" scontext=u:r:audioserver:s0 tcontext=u:r:netd:s0tclass=unix_stream_socket permissive=1 把所有相關 log 全部篩選出來,存放在一個log 文件中, 例如存放在名為audiohal_avc.log 的文件中。

通過如下命令可以自動生成 avc 規則: external/selinux/prebuilts/bin$ ./audit2allow -i audiohal_avc.log

生成的規則如下:

#============= audioserver==============

allow? audioserver:fileopen;

allow? audioserverfwmarkd_socket:sock_filewrite;

allow? audioservernetd:unix_stream_socket connectto;

allow? audioservernode:udp_socketnode_bind; allowaudioserverself:tcp_socket create;

allow audioserverself:udp_socket{writebindcreategetattrconnect};

將上述規則添加到相應的系統 te 文件中即可。

系統 xxx.te 文件存放位置一般在如下兩個地方:

1./external/sepolicy(注 7.0 及以上在/system/sepolicy)下面的 xxx.te

2.device/xxxxxxxx/common/sepolicy 下面的 xxxx.te。 添加好規則之后重新編譯固件進行刷機測試,重復上述步驟,直到 log 中沒有再出現audiohal avc 相關提示警告信息。

添加規則編譯的時候有可能會出現 neverallow 規則沖突,導致編譯出錯。此時需要到 系統限定 neverallow 規則的 te 文件中去掉相關限制即可編譯通過。

更加詳細的方法可以 自行查看相關資料。修改 neverallow 規則會導致 cts 測試無法通過,請知悉。如果系統無 需過 cts 認證,可以按需求修改系統 neverallow 規則。

?

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的selinux-添加的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 一道本无吗一区 | 美女aaa| 麻豆传媒在线视频 | 91精品婷婷国产综合久久蝌蚪 | 久久久久中文字幕亚洲精品 | 日韩一区二区三区四区五区六区 | 免费中文字幕日韩 | 久久久久久在线观看 | 在线观看成人av | 欧美大胆a视频 | 欧美69久成人做爰视频 | 亚洲片国产一区一级在线观看 | 成人做爰视频www网站小优视频 | 亚洲综合精品国产 | 日批在线观看 | 黑人精品欧美一区二区蜜桃 | 国产一区二区三区四区在线观看 | 无码人妻精品一区二 | 国产第九页| 精品国产视频一区二区三区 | 国产精品久久久久久在线观看 | 欧美a视频| 日日干日日操 | 亚洲国产一区二区三区 | 成人福利片| 高h校园不许穿内裤h调教 | www.-级毛片线天内射视视 | 久久精品视频在线 | 亚洲αv | 中文字幕亚洲专区 | 欧美日韩视频 | 婷婷俺也去| 午夜写真片福利电影网 | 一级黄色片视频 | 韩国性猛交╳xxx乱大交 | 成人理论片 | 中文字母av| 色就色综合 | 欧美日韩福利视频 | 爱吃波客今天最新视频 | 欧美特级特黄aaaaaa在线看 | 国产噜噜噜噜噜久久久久久久久 | xxxx黄色片| 国产精品v日韩精品v在线观看 | 先锋影音av中文字幕 | 性生交大片免费看 | 美女被草视频在线观看 | 国产一区二区三区在线 | 美人被强行糟蹋np各种play | 青青成人网 | 婷婷国产成人精品视频 | 青草青青视频 | 成人黄色电影在线 | 欧美一级黄视频 | 日本在线视频一区二区三区 | www亚洲 | 亚洲电影在线观看 | 国产午夜精品一区二区三区视频 | 午夜在线免费观看 | 精品国产乱码久久久久久蜜臀网站 | av片国产| 黄色天堂网 | 视频福利在线 | 欧美亚洲色综久久精品国产 | 999久久久久 | 久久久久久久久久久av | 大奶子av | 紧身裙女教师三上悠亚红杏 | 狼人伊人干 | 成人免费观看a | 国语对白一区二区三区 | 欧美一级做性受免费大片免费 | 日本国产欧美 | 国产激情视频 | 奇米影视亚洲 | 日韩亚洲欧美在线 | www黄色大片 | 欧美男人天堂 | 四季av在线一区二区三区 | 国产手机在线播放 | 女性爱爱视频 | 国产欧美日韩激情 | 久久精品无码专区免费 | 91看片黄 | 黄色靠逼视频 | 老太婆av| 日韩女人性猛交 | 中文字幕电影一区 | 日本少妇毛茸茸高潮 | 国产成人无码精品久在线观看 | 超碰天堂 | 日本中文字幕成人 | 日本黄网站| 天天操夜夜操 | 纯爱无遮挡h肉动漫在线播放 | 中文字幕亚洲乱码熟女1区2区 | 成人日韩 | 成年人免费在线观看视频网站 | 99亚洲精品 |