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:- Create a Pull Request on SELinuxProject/refpolicy.
- Store changes as patch in
meta-qcom-distro/recipes-security/refpolicy/refpolicy-targeted/directory and include patch in SRC_URImeta-qcom-distro/recipes-security/refpolicy/refpolicy-targeted_git.bbappend - Create a Pull Request on qualcomm-linux/meta-qcom-distro
- Send patch to [meta-selinux]https://github.com/ni/meta-selinux. Refer to [Steps to send patches to meta-selinux]https://github.com/ni/meta-selinux/blob/nilrt/master/scarthgap/MAINTAINERS. This step is optional as changes are automatically synced from upstream refpolicy on meta-selinux upgrade.
- 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_URImeta-updater/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted_git.bbappend - Create a Pull Request on uptane/meta-updater
- 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_URImeta-qcom/dynamic-layers/selinux/recipes-security/refpolicy/refpolicy-targeted_git.bbappend - Create a Pull Request on qualcomm-linux/meta-qcom
- Create new
<module_name>.fc,<module_name>.if,<module_name>.tefiles 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 anddynamic-layers/.../refpolicy-targeted_git.bbappendrecipe to include patches.
- To change the SELinux type and mode, you can edit the Selinux base file.
Compile SEPolicy
- Set up the build environment. For instructions, see Qualcomm Linux Build Guide.
- Compiling only selinux distro:
- 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./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
Ifdenials.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
- To provision RPMB with test key, see Verify RPMB provisioning status
- 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:
Next steps
- For common logging and debugging techniques, see Debug Qualcomm TEE and secure devices.
- To learn how to develop and run trusted and client applications, and for sample code and examples, see Develop trusted and client applications.

