Skip to main content
Customization is supported for memory and SEPolicy. For a large-size trusted application, you can customize the memory regions.

Customize memory

To customize memory, this feature is available to licensed users with authorized access. If you have access, see Qualcomm Linux Security Guide - Addendum.

Customize SEPolicy

Qualcomm SEPolicy depends on the upstream SEPolicy. Therefore, the upstream SEPolicy’s make system is used for building and customizing the SEPolicy. Customization to upstream selinux policy: Customization to ostree selinux policy:
  • Create a Patch on top of existing sepolicy code.
  • Store changes as patch in meta-updater/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted/ directory and include patch in SRC_URI meta-updater/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted_git.bbappend
  • Create a Pull Request on uptane/meta-updater
Customization to qualcomm selinux policy:
  • Create a Patch on top of exisiting sepolicy code.
  • Store changes as patch in meta-qcom/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted/ directory and include patch in SRC_URI meta-qcom/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted_git.bbappend
  • Create a Pull Request on qualcomm-linux/meta-qcom
Adding sepolicy for new service/module:
  • Create new <module_name>.fc, <module_name>.if, <module_name>.te files on top of existing selinux policy and add required selinux rules.
  • Upstream the new module to SELinuxProject/refpolicy. Skip this step if service/module is private.
  • Determine the yocto layer where service/module exist. Inside that layer, create dynamic-layers/.../refpolicy-targeted/ for keeping sepolicy as patches and dynamic-layers/.../refpolicy-targeted_git.bbappend recipe to include patches.
The Qualcomm code is configured to the modular SEPolicy mode and SELinux types as targeted. To modify the SEPolicy mode and the SELinux types, do the following:

Compile SEPolicy

  1. Set up the build environment. For instructions, see Qualcomm Linux Build Guide.
  2. Compiling only selinux distro:
  3. Compiling catchall distro (This distro contains selinu with some other distro features):

Modify and build

You can also modify and build incrementally. The audit2allow and research tools on Ubuntu don’t support policy version35. You can run audit2allow by installing policycoreutils-python-utils.
Then run audit2allow on this shell . Pull the policy version35 from the target /etc/selinux/targeted/policy/policy.35. This policy is also available in the build tree: build/tmp/sysroots-components/<machine_name>/refpolicy-targeted/etc/selinux/targeted/policy/policy.35

Capture denials

If denials.txt is a file capturing the denials, use the following command to solve the denials:

Provision replay protected memory block

Replay protected memory block (RPMB) provisioning is a one time process for lifetime of the device and it’s irreversible.
  • Provision RPMB for secure boot devices:
    • RPMB is automatically provisioned with production keys during the secure boot process.
    • Don’t provision RPMB before enabling secure boot.
    • Don’t follow any explicit steps to provision RPMB for secure boot devices.
  • Provision RPMB for non-secure boot devices:
    • You can provision RPMB with test keys for testing and exercising certain use cases to observe the functionality similar to secure boot devices. Examples use cases include:
      • Secure file system (SFS) file version information and anti-rollback protection
      • Trusted application anti-rollback protection
    Secure boot can’t be enabled on a device once RPMB is provisioned with test keys.

Next steps