Skip to contentSkip to conversation

Bootloader components missing from image SBOM

RFC In review Leonardo Costa 2 participants 8 messages May 26 – Jun 11

lore
Share & tools
lore
#0 lore raw

Hello all,

We are planning to release SPDX SBOMs along with our images to provide package information about the software components that make them up.

As it currently stands today, bootloader components are not included in the final SBOM generated for the image. In particular, for our machines based on i.MX SoCs, the imx-boot container, along with boot components (ATF, SECO, SCFW) have their SPDX files generated in spdx/, but not included in the image SBOM.

If I understand correctly, the SBOM is generated by looking at the packages in the rootfs, and recursively adding their SPDX entries along with the ones for their dependencies. In our builds, I found that U-Boot does get included in the SBOM, but in our particular case this seems to be due to the presence of libubootenv in the rootfs, which has the U-Boot recipe in its dependency chain, so the inclusion of U-Boot in the SBOM is only a side effect.

I have not seen anyone raise this as an issue, but my intuition is that this information should be included in the SBOM. Despite not making it to the rootfs, these boot components are still part of the image. CVE information about them, for example, is relevant to users.

My question is, is there any configuration that should be set to include these components? I couldn't find anything about this in the documentation or in the code. If there is no configuration regarding this, would a contribution to add components such as these be welcome?

Kind regards,

Leonardo

#1 lore raw
Quoted 20 lines

We are planning to release SPDX SBOMs along with our images to provide package information about the software components that make them up.

As it currently stands today, bootloader components are not included in the final SBOM generated for the image. In particular, for our machines based on i.MX SoCs, the imx-boot container, along with boot components (ATF, SECO, SCFW) have their SPDX files generated in spdx/, but not included in the image SBOM.

If I understand correctly, the SBOM is generated by looking at the packages in the rootfs, and recursively adding their SPDX entries along with the ones for their dependencies. In our builds, I found that U-Boot does get included in the SBOM, but in our particular case this seems to be due to the presence of libubootenv in the rootfs, which has the U-Boot recipe in its dependency chain, so the inclusion of U-Boot in the SBOM is only a side effect.

I have not seen anyone raise this as an issue, but my intuition is that this information should be included in the SBOM. Despite not making it to the rootfs, these boot components are still part of the image. CVE information about them, for example, is relevant to users.

Quoted 4 lines

My question is, is there any configuration that should be set to include these components? I couldn't find anything about this in the documentation or in the code. If there is no configuration regarding this, would a contribution to add components such as these be welcome?

Following up on this, I just wanted to know if this behavior is intended to stay as it currently is or if it's worth working on a patch to add components beyond the ones that are in the final rootfs.

Kind regards,

Leonardo

#2 lore raw
Quoted 21 lines · Leonardo Costa
Quoted 21 lines

We are planning to release SPDX SBOMs along with our images to provide package information about the software components that make them up.

As it currently stands today, bootloader components are not included in the final SBOM generated for the image. In particular, for our machines based on i.MX SoCs, the imx-boot container, along with boot components (ATF, SECO, SCFW) have their SPDX files generated in spdx/, but not included in the image SBOM.

If I understand correctly, the SBOM is generated by looking at the packages in the rootfs, and recursively adding their SPDX entries along with the ones for their dependencies. In our builds, I found that U-Boot does get included in the SBOM, but in our particular case this seems to be due to the presence of libubootenv in the rootfs, which has the U-Boot recipe in its dependency chain, so the inclusion of U-Boot in the SBOM is only a side effect.

I have not seen anyone raise this as an issue, but my intuition is that this information should be included in the SBOM. Despite not making it to the rootfs, these boot components are still part of the image. CVE information about them, for example, is relevant to users.

Quoted 8 lines
Quoted 4 lines

My question is, is there any configuration that should be set to include these components? I couldn't find anything about this in the documentation or in the code. If there is no configuration regarding this, would a contribution to add components such as these be welcome?

Following up on this, I just wanted to know if this behavior is intended to stay as it currently is or if it's worth working on a patch to add components beyond the ones that are in the final rootfs.

It is a known limitation that things that are not in the root filesystem image are not included in the SBoM. The biggest problem is that it is quite tricky to figure out how to correctly indicate that a given non-image task is building an "aggregate" of some other things and thus needs to produce an aggregated SBoM, along with the dificultlies of plumbing in SBoM generation to arbitrary tasks. Image tasks are much simpler to solve because they are well formed in how they operate.

If you have suggestions for how to deal with this, I would welcome them.

Quoted 4 lines

Kind regards,

Leonardo

#3 lore raw
In reply to Leonardo Costa
Quoted 23 lines · Leonardo Costa via lists.openembedded.org

Hello all,

We are planning to release SPDX SBOMs along with our images to provide package information about the software components that make them up.

As it currently stands today, bootloader components are not included in the final SBOM generated for the image. In particular, for our machines based on i.MX SoCs, the imx-boot container, along with boot components (ATF, SECO, SCFW) have their SPDX files generated in spdx/, but not included in the image SBOM.

If I understand correctly, the SBOM is generated by looking at the packages in the rootfs, and recursively adding their SPDX entries along with the ones for their dependencies. In our builds, I found that U-Boot does get included in the SBOM, but in our particular case this seems to be due to the presence of libubootenv in the rootfs, which has the U-Boot recipe in its dependency chain, so the inclusion of U-Boot in the SBOM is only a side effect.

I have not seen anyone raise this as an issue, but my intuition is that this information should be included in the SBOM. Despite not making it to the rootfs, these boot components are still part of the image. CVE information about them, for example, is relevant to users.

Quoted 4 lines

My question is, is there any configuration that should be set to include these components? I couldn't find anything about this in the documentation or in the code. If there is no configuration regarding this, would a contribution to add components such as these be welcome?

FYI, I started working on this in oe-contrib/jpew/spdx-deploy
(https://git.openembedded.org/openembedded-core-contrib/log/?h=jpew/spdx-deploy)
if you can try it out and make sure it will allow you to do what you want, I would appreciate it

Quoted 13 lines

Kind regards,

Leonardo

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#237625): https://lists.openembedded.org/g/openembedded-core/message/237625
Mute This Topic: https://lists.openembedded.org/mt/119502448/3616693
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

Hi Joshua,

Sorry for the delay.

Quoted 4 lines

FYI, I started working on this in oe-contrib/jpew/spdx-deploy
(https://git.openembedded.org/openembedded-core-contrib/log/?h=jpew/spdx-deploy)
if you can try it out and make sure it will allow you to do what you want, I would appreciate it

I've done some tests, and it does solve these cases mostly. However, I got errors in the case of Heteorenous Multi-Processing. Some packages are built for both cores, and the build tries to generate two SBOMs with the same name.

For instance, on the Verdin AM62 the U-Boot recipe fails because U-Boot is built for both the Cortex A53 and Cortex R5, and both SBOMs are named u-boot-toradex-deploy-sbom.spdx.json:

ERROR: mc:k3r5:u-boot-toradex-1_mainline-r0 do_create_deploy_sbom: Recipe u-boot-toradex is trying to install files into a shared area when those files already exist. The files and the manifests listing them are:
build/deploy/images/verdin-am62/u-boot-toradex-deploy-sbom.spdx.json
(not matched to any task)
Please adjust the recipes so only one recipe provides a given file.

This could be solved if each recipe could define a custom name for its deploy SBoM. Then the name could be altered for different cortexes in the same build I made a small patch on top of your branch, adding a SPDX_DEPLOY_SBOM_NAME variable that allows this (similar to the existing SPDX_RECIPE_SBOM_NAME), I'll send it in reply to this email. Let me know what you think.

Kind regards,
Leonardo

#5 lore raw

RFC PATCH 1/1 spdx: Add ability to change the deploy SBoM name

From: Leonardo Costa <[email protected]>

Allow "deploy" tasks that have set SPDX_DEPLOY_TASKS to choose a custom name for their deploy SBoM.

---
 meta/classes/create-spdx-3.0.bbclass | 4 ++++
 meta/lib/oe/spdx30_tasks.py          | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
meta/classes/create-spdx-3.0.bbclass +4 -0
index f915f5cfd5..1444816530 100644
@@ -178,6 +178,10 @@ SPDX_DEPLOY_TASKS[doc] = "A space separated list of sstate tasks that produce \
     'after do_create_spdx'.\
     "
 
+SPDX_DEPLOY_SBOM_NAME ?= "${PN}-deploy-sbom"
+SPDX_DEPLOY_SBOM_NAME[doc] = "The name of the output deploy SBoM when using \
+    create_deploy_sbom"
+
 SPDX_DEPLOY_ARTIFACTS = "AUTO"
 SPDX_DEPLOY_ARITFACTS[doc] = "A space separated list of deployed artifacts, \
     relative to SPDX_DEPLOY_ARTIFACTS_DIR that should be included in the SBoM. \
meta/lib/oe/spdx30_tasks.py +1 -1
index b69f79eae9..d56cbe543e 100644
@@ -1885,7 +1885,7 @@ def create_deploy_spdx(d, spdxdeploydir, artifactsdir, artifacts):
 
 def create_deploy_sbom(d, deploydir, deploy_tasks):
     pn = d.getVar("PN")
-    sbom_name = f"{pn}-deploy-sbom"
+    sbom_name = d.getVar("SPDX_DEPLOY_SBOM_NAME")
 
     objsets = []
     for t in deploy_tasks:
#6 lore raw

Re: [PATCH] [OE-core] [RFC] spdx: Add ability to change the deploy SBoM name

Quoted 5 lines · Leonardo Costa

From: Leonardo Costa <[email protected]>

Allow "deploy" tasks that have set SPDX_DEPLOY_TASKS to choose a custom name for their deploy SBoM.

LGTM. I will pull this onto my local branch since it depends on my changes; would you be OK if I squashed it into my change that adds the task, or would you prefer it be a separate commit?

Quoted 35 lines
---
 meta/classes/create-spdx-3.0.bbclass | 4 ++++
 meta/lib/oe/spdx30_tasks.py          | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
meta/classes/create-spdx-3.0.bbclass +4 -0
index f915f5cfd5..1444816530 100644
@@ -178,6 +178,10 @@ SPDX_DEPLOY_TASKS[doc] = "A space separated list of sstate tasks that produce \
     'after do_create_spdx'.\
     "
 
+SPDX_DEPLOY_SBOM_NAME ?= "${PN}-deploy-sbom"
+SPDX_DEPLOY_SBOM_NAME[doc] = "The name of the output deploy SBoM when using \
+    create_deploy_sbom"
+
 SPDX_DEPLOY_ARTIFACTS = "AUTO"
 SPDX_DEPLOY_ARITFACTS[doc] = "A space separated list of deployed artifacts, \
     relative to SPDX_DEPLOY_ARTIFACTS_DIR that should be included in the SBoM. \
meta/lib/oe/spdx30_tasks.py +1 -1
index b69f79eae9..d56cbe543e 100644
@@ -1885,7 +1885,7 @@ def create_deploy_spdx(d, spdxdeploydir, artifactsdir, artifacts):
 
 def create_deploy_sbom(d, deploydir, deploy_tasks):
     pn = d.getVar("PN")
-    sbom_name = f"{pn}-deploy-sbom"
+    sbom_name = d.getVar("SPDX_DEPLOY_SBOM_NAME")
 
     objsets = []
     for t in deploy_tasks:
#7 lore raw

RFC PATCH 1/1 Bootloader components missing from image SBOM

Hi Joshua,

Quoted 1 line

LGTM. I will pull this onto my local branch since it depends on my

changes; would you be OK if I squashed it into my change that adds the task, or would you prefer it be a separate commit?

Yes, it's OK if you squash it, and thanks for looking into this!

Leonardo