天天看點

SEAndroid中sepolicy/adbd.te政策檔案分析

版權聲明:您好,轉載請留下本人部落格的位址,謝謝 https://blog.csdn.net/hongbochen1223/article/details/48549091

在adbd.te政策檔案中,很明顯,定義了一些關于adbd,也就是adb守護程序的一些政策.下面我們先來看一下這個政策源碼:

# adbd seclabel is specified in init.rc since
# adbd安全标簽是在init.rc中被指定的

# it lives in the rootfs and has no unique file type.
# 他存在于根檔案系統中,沒有唯一的檔案類型。
type adbd, domain;    # 定義adbd類型辨別符,其屬性集合為domain

permissive adbd;      # 将adbd設定為permissive運作方式,也就是即使出現問題,也不會影響正常的運作,僅僅就是把錯誤發送給dmesg

unconfined_domain(adbd) # 無限制的域

# 直接調用宏,後面講解;
# 在這裡的作用是:通過執行一個被貼上标志符的檔案來自動從舊域轉到新域
domain_auto_trans(adbd, shell_exec, shell)

# this is an entrypoint
# 這是一個入口點
allow adbd rootfs:file entrypoint;

# Read /data/misc/adb/adb_keys.
# 讀取 /data/misc/adb/adb_keys檔案
allow adbd adb_keys_file:dir search;
allow adbd adb_keys_file:file r_file_perms;

# Allow access in case /data/misc/adb still has the old type.
# 當/data/misc/adb依然有舊域的話,也允許通路
allow adbd system_data_file:dir search;
allow adbd system_data_file:file r_file_perms;
           

總的來說,這裡首先是定義了一個域辨別符adbd,同時,設定了他的運作模式,也為該域定義了一些政策,允許其自動轉換成新域,并且無論是新标志符還是舊标志符都可以通路/data/misc/adb下的檔案.