Android SELinux——上下文Context源码(十)

        通过前面的文章我们知道,SELinux 中的上下文(contexts)包含很多类型,这里我们就来看看Androd 源码中 上下文 SELinux Contexts 的代码结构。

一、Contexts源码

源码位置:/system/sepolicy/private

1、file_contexts

        file_contexts 文件用于定义系统中各个文件和目录的 SELinux 上下文(context),即为每个文件或目录设置其 SELinux 标签。这些标签包括用户、角色、类型和级别,用于控制文件的访问权限。

源码展示

# Root
/                   u:object_r:rootfs:s0

# Data files
/adb_keys           u:object_r:adb_keys_file:s0
/build\.prop        u:object_r:rootfs:s0
/default\.prop      u:object_r:rootfs:s0
……

# Executables
/init               u:object_r:init_exec:s0
/sbin(/.*)?         u:object_r:rootfs:s0

# For kernel modules
/lib(/.*)?          u:obje

猜你喜欢

转载自blog.csdn.net/c19344881x/article/details/142585822