其中的目录路径映射到SELinux android中的文件类型

问题描述 投票:1回答:1

我看到文件系统类型和文件类型在AOSP的/external/sepolicy/file.te中声明。但是每种类型都表示或映射到注释中提到的特定目录。

链接:https://android.googlesource.com/platform/external/sepolicy/+/refs/heads/lollipop-release/file.te

示例1:

#Default type for anything under /system.
type system_file, file_type;

示例2:

#/data/data subdirectories - app sandboxes
type app_data_file, file_type, data_file_type;

这意味着我们正在声明类型app_data_file,并将此类型与属性file_typedata_file_type关联>

注意:所有属性都在属性文件中声明。

链接:https://android.googlesource.com/platform/external/sepolicy/+/refs/heads/lollipop-release/attributes

  1. 提到类型system_file用于路径/systemapp_data_file用于/data/data子目录。但是这些类型和路径在哪里明确映射或关联?如果它们没有映射到任何地方,那么操作系统将如何知道system_file用于/system

  2. 如果必须创建新类型my_app_type并将其映射到目录/data/com.my_app/photos/,该如何实现?

我看到文件系统类型和文件类型在AOSP的/external/sepolicy/file.te中声明。但是每种类型都表示或映射到注释中提到的特定目录。链接:...

android android-source selinux android-5.1.1-lollipop google-source-repositories
1个回答
2
投票

这些被标记,例如。 device/manufacturer/device-name/sepolicy/file_contexts和其他file_contexts文件(构建AOSP时可以看到)。有关更多详细说明,请参见Label new services and address denials

© www.soinside.com 2019 - 2024. All rights reserved.