Skip to content

docs: add production security hardening recommendations#1972

Open
jaihindy wants to merge 1 commit into
qualcomm-linux:masterfrom
jaihindy:jaihindy-security-recommendation
Open

docs: add production security hardening recommendations#1972
jaihindy wants to merge 1 commit into
qualcomm-linux:masterfrom
jaihindy:jaihindy-security-recommendation

Conversation

@jaihindy
Copy link
Copy Markdown

This change adds documented security hardening recommendations for
production devices.

These recommendations were discussed and suggested to be added to
the README in:
#1244

The documentation is intended to provide clear guidance to downstream
integrators and deployers when preparing commercial or production
deployments. No functional or default behavior changes are introduced.

@quaresmajose
Copy link
Copy Markdown
Contributor

I think this should be in a new document and referenced in the README, since it's more suited to advanced use cases. The README is the first impression users have of the layer and should be simple and minimalist.

Copy link
Copy Markdown
Contributor

@lumag lumag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please make sure to wrap too long lines.

Comment thread README.md Outdated
Disable via kernel config:
```text
CONFIG_DEBUG_FS
````
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean? Please document the actual steps to disable debugfs

Comment thread README.md Outdated

Steps:

* Edit your distro configuration file (for example, `conf/distro/<your-distro>.conf`).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is editing qcom-distro.conf a recommended way of enabling hardened config?

Comment thread README.md Outdated
```sh
bitbake <image-name>
```
* Verify hardening options in the kernel `.config` (expected to be set to `y`), for example:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the .config located?

Comment thread README.md Outdated

```text
printk.devkmsg={on,off,ratelimit}
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to enable / set it?

Comment thread README.md Outdated

```sh
sudo sysctl -w kernel.kptr_restrict=2
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to enable it by default?

Comment thread README.md Outdated




Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many empty lines.

Comment thread README.md Outdated

### 4. Signed module loading enforcement

Signed module loading enforcement is currently disabled. As part of commercialization/production hardening, this check should be enabled to prevent loading unsigned kernel modules.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How?

Comment thread README.md Outdated
* `0` = no restriction (any user can read dmesg)
* `1` = restricted (only root can read dmesg) (**recommended for production**)

To enforce at boot, set `/proc/sys/kernel/dmesg_restrict` to `1` (for example, from an init/startup script). You can also set it at runtime with:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How?

@ricardosalveti
Copy link
Copy Markdown
Contributor

ricardosalveti commented Apr 17, 2026

Why are we changing readme for this? We should probably have this as a dedicated page under a docs folder or similar.

Create a dedicated md and point it from our main readme.

@jaihindy
Copy link
Copy Markdown
Author

Why are we changing readme for this? We should probably have this as a dedicated page under a docs folder or similar.

Create a dedicated md and point it from our main readme.

Thanks for the suggestion. I’ll move this content into a dedicated markdown document (and link it from the main README) to keep the README high‑level. Please let me know if you have a preferred location for the doc.

@ricardosalveti
Copy link
Copy Markdown
Contributor

Thanks for the suggestion. I’ll move this content into a dedicated markdown document (and link it from the main README) to keep the README high‑level. Please let me know if you have a preferred location for the doc.

A folder like 'docs' would be fine, we are using something similar at https://github.com/qualcomm-linux/meta-qcom-3rdparty/tree/main/docs.

@jaihindy jaihindy closed this Apr 22, 2026
@jaihindy
Copy link
Copy Markdown
Author

closing this PR , As suggested I'll create the PR - https://github.com/qualcomm-linux/meta-qcom-3rdparty/tree/main/docs.

@lumag lumag reopened this Apr 22, 2026
@lumag
Copy link
Copy Markdown
Contributor

lumag commented Apr 22, 2026

Why? The comment was not about moving the document to meta-qcom-3rdparty. It was about moving it under docs folder here.

@ricardosalveti
Copy link
Copy Markdown
Contributor

Yup, the 3rdparty link was just to give an example.

@jaihindy jaihindy force-pushed the jaihindy-security-recommendation branch 3 times, most recently from ca5ac5b to 2df0f42 Compare April 23, 2026 06:46
Copy link
Copy Markdown
Contributor

@lumag lumag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PLease go through the previous feedback and implement it.

@jaihindy jaihindy requested a review from lumag April 23, 2026 09:54
@github-actions
Copy link
Copy Markdown

Test run workflow

Test jobs for commit 2df0f42a258b842323298a7a9c8c848640392f62

Test dragonboard-820c qcs615-adp-air qcs6490 qcs8300 qcs9100 qcs9100-rb8 qrb2210-rb1
AudioRecord 🚫 pass pass pass pass 🚫 pass
BT_FW_KMD_Service 🚫 pass pass pass pass pass pass
BT_ON_OFF 🚫 pass pass pass pass pass pass
BT_SCAN 🚫 pass fail pass pass fail pass
CPUFreq_Validation 🚫 pass pass pass pass pass pass
DSP_AudioPD 🚫 pass pass pass pass pass pass
Ethernet 🚫 ⚠️ skip 🚫 pass pass pass ⚠️ skip
Interrupts 🚫 pass pass pass pass pass pass
KMSCube 🚫 ⚠️ skip pass pass fail ⚠️ skip pass
OpenCV 🚫 pass pass pass pass pass pass
WiFi_Firmware_Driver 🚫 pass pass pass pass pass pass
WiFi_OnOff 🚫 pass pass pass pass pass pass
adsp_remoteproc 🚫 pass pass pass pass pass pass
boot pass pass pass pass pass pass pass
cdsp_remoteproc 🚫 pass pass pass pass pass ⚠️ skip
core_auth 🚫 pass pass pass pass pass pass
fastrpc_test 🚫 pass pass pass pass pass 🚫
hotplug 🚫 pass pass pass pass pass pass
irq 🚫 pass pass pass pass pass pass
weston-simple-egl 🚫 ⚠️ skip pass pass pass ⚠️ skip pass

All jobs summary

Job ID Device State Health
185855 qcs9100-rb8 Finished Complete
185786 qcs9100 Finished Complete
185785 qrb2210-rb1 Finished Complete
185771 qcs9100-rb8 Finished Complete
185862 qcs9100 Finished Complete
185780 qcs615-adp-air Finished Complete
185836 qcs8300 Finished Complete
185861 qrb2210-rb1 Finished Complete
185842 qrb2210-rb1 Finished Complete
185828 qrb2210-rb1 Finished Complete
185853 qcs615-adp-air Finished Complete
185847 qcs9100-rb8 Finished Complete
185779 qcs615-adp-air Finished Complete
185825 qcs6490 Finished Complete
185864 qcs8300 Finished Complete
185787 qcs9100-rb8 Finished Complete
185850 qcs6490 Finished Complete
185835 qrb2210-rb1 Finished Complete
185778 dragonboard-820c Finished Complete
185838 qcs8300 Finished Complete
185846 qcs8300 Finished Complete
185788 qcs9100-rb8 Finished Complete
185775 qcs8300 Finished Complete
185781 qcs8300 Finished Complete
185770 qcs6490 Finished Complete
185777 qcs9100-rb8 Finished Complete
185856 qcs6490 Finished Complete
185851 qcs9100 Finished Complete
185768 qcs615-adp-air Finished Complete
185782 qrb2210-rb1 Finished Complete
185776 qcs8300 Finished Complete
185870 qrb2210-rb1 Finished Complete
185857 qcs6490 Finished Complete
185867 qcs6490 Finished Complete
185839 qcs6490 Finished Complete
185849 qcs615-adp-air Finished Complete
185869 qcs615-adp-air Running Unknown
185803 dragonboard-820c Finished Complete
185791 qcs615-adp-air Finished Complete
185854 qrb2210-rb1 Finished Complete
185774 qcs8300 Finished Complete
185859 qcs9100-rb8 Finished Complete
185844 qcs615-adp-air Finished Complete
185866 qcs615-adp-air Running Unknown
185860 qcs9100-rb8 Finished Complete
185769 qcs9100 Finished Complete
185868 qcs9100 Finished Complete
185773 qrb2210-rb1 Finished Complete
185843 qcs8300 Finished Complete
185841 qrb2210-rb1 Finished Complete
185845 qcs6490 Finished Complete
185789 qcs6490 Finished Complete
185852 qcs9100 Finished Complete
185848 qcs615-adp-air Finished Complete
185837 qcs9100 Finished Complete
185790 qcs9100 Finished Complete
185840 qcs9100-rb8 Finished Complete
185784 qcs6490 Finished Complete
185858 qcs8300 Finished Complete
185793 dragonboard-820c Finished Complete
185783 qcs9100 Finished Complete
185865 qcs9100 Finished Complete
185863 qcs9100-rb8 Finished Complete
185772 dragonboard-820c Finished Complete

@test-reporting-app
Copy link
Copy Markdown

Test Results

   62 files   -   2    268 suites   - 18   3h 12m 16s ⏱️ - 15m 52s
   59 tests  -   2     57 ✅ + 16   0 💤 ±0  2 ❌  - 18 
2 518 runs   - 161  2 501 ✅  - 147  13 💤 +3  4 ❌  - 17 

For more details on these failures, see this check.

Results for commit 2df0f42a. ± Comparison against base commit 5e5f490.

This pull request removes 2 tests.
lava ‑ auto-login-action
lava ‑ minimal-boot

Comment thread docs/security-recommendations.md Outdated
For example, in meta-qcom CI configurations, setting:

```text
DEBUG_BUILD = "0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already set by default.

Comment thread docs/security-recommendations.md Outdated
CONFIG_DEBUG_FS=n
````

This can be achieved by updating the kernel defconfig or by applying a kernel configuration fragment in the Yocto build.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide exact steps. You are not writing a generic training. This is a part of the meta-qcom, so you should be describing steps which are applicable to meta-qcom.

Comment thread docs/security-recommendations.md Outdated
Rate limiting for kernel log output (for example via `/dev/kmsg` or the serial console) can be configured using kernel command-line parameters.

For production builds, enabling printk rate limiting is recommended to avoid excessive kernel log exposure. This is typically configured via the
kernel command line set by the bootloader or Yocto kernel command line configuration.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How?

Comment thread docs/security-recommendations.md Outdated

For commercial/production builds, it is recommended to set this to restrict kernel pointer visibility to privileged users only.

This should be enabled by default using persistent sysctl configuration (as part of the image), rather than manual runtime commands.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How?

@jaihindy jaihindy force-pushed the jaihindy-security-recommendation branch from 2df0f42 to 47c372d Compare April 24, 2026 12:38
@jaihindy
Copy link
Copy Markdown
Author

Thanks a lot for the feedback. I’ve updated the document to make the guidance meta-qcom specific, clarified the exact configuration mechanisms, and removed examples that are already default.
Please let me know if any further adjustments are needed.

Document recommended security settings for production devices,
including kernel hardening, logging restrictions, signed module
enforcement, DebugFS handling, and ADB access limitations.

Signed-off-by: Jaihind Yadav <jaihindy@qti.qualcomm.com>
@jaihindy jaihindy force-pushed the jaihindy-security-recommendation branch from 47c372d to 4c4508e Compare April 24, 2026 12:43
@jaihindy jaihindy requested a review from lumag April 24, 2026 12:45
@lumag
Copy link
Copy Markdown
Contributor

lumag commented Apr 24, 2026

@jaihindy I really want to see the exact recipes. Like "open file foo and write bar there". Current text is stilll vague and imprecise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants