Bug 15212 - u-boot partition environement variable is always writable regardless of force_ro value
Summary: u-boot partition environement variable is always writable regardless of force...
Status: RESOLVED FIXED
Alias: None
Product: BSPs
Classification: Build System, Metadata & Runtime
Component: bsps-configuration (show other bugs)
Version: 4.0
Hardware: x86 Multiple
: Undecided normal
Target Milestone: 0.0.0
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2023-09-11 11:07 UTC by SAHEERK
Modified: 2023-09-12 11:46 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SAHEERK 2023-09-11 11:07:41 UTC
On my platform, the u-boot environment variables can always be modified. Currently, I'm changing the value of force_ro to '1', which sets the permission mode to read-only.
This change is reflected in the output of the lsblk command. However, even after rebooting my device, I can still write values to my boot partition, and the changes persist.

Here are the results of my test:

$ cat /sys/block/mmcblk0boot1/force_ro
1 
$ fw_setenv primary 2 
$ fw_printenv primary
 2

Here are some details about my platform:
> Cross Compiler: Yocto EL40(Kirkstone)
> Bootloader: u-boot
> U-boot Source: git://github.com/nxp-imx/uboot-imx.git;protocol=https
> U-boot Source Branch: lf_v2022.04

> fw_setenv and fw_printenv package version in Yocto: libubootenv_0.3.2

Hardware details:
> System Architecture: arm
> CPU: armv8
> SoC: imx8m

Could anyone suggest a solution to make my boot partition read-only based on the value of force_ro?
Comment 1 SAHEERK 2023-09-12 11:46:24 UTC
This issue reason was the libubootenv commit: https://github.com/sbabic/libubootenv/commit/92949816720d7af2ac722016e7a5b9a85ff141bc. which bypasses the force_ro protection to write. So for my platform, I am going to edit the source code of libubootenv


Thanks