Skip to contentSkip to conversation

Set custom CPE_ID_VERSION when using custom sources

PATCH In review Heiko Stuebner via buildroot 1 participant 6 messages Mar 18 – Nov 20

lore
Share & tools
lore
#0 lore raw

v2 cover Set custom CPE_ID_VERSION when using custom sources

From: Heiko Stuebner <[email protected]>

Linux, U-Boot, OP-TEE allow using custom sources that not directly declare their base-version, but instead either will report "custom" or a git/hg revision as their version.

When generating a cpe string using that, any tooling needing that, for example CVE checkers using the show-info / sbom will report incorrect results in that case.

So for these cases, allow declaring the software version that is hiding in the sources that is used.

changes in v2:
- v1 didn't reach the mailinglist due to me not having subscribed yet but already some people directly in Cc
- Don't use 2 symbols when 1 is enough (no bool + string, just a string)

Heiko Stuebner (3):
boot/optee-os: add option to override the CPE_ID_VERSION boot/uboot: add option to override the CPE_ID_VERSION
linux: add option to override the CPE_ID_VERSION

 boot/optee-os/Config.in   | 11 +++++++++++
 boot/optee-os/optee-os.mk |  3 +++
 boot/uboot/Config.in      | 11 +++++++++++
 boot/uboot/uboot.mk       |  3 +++
 linux/Config.in           | 12 ++++++++++++
 linux/linux.mk            |  3 +++
 6 files changed, 43 insertions(+)
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 1/3 boot/optee-os: add option to override the CPE_ID_VERSION

From: Heiko Stuebner <[email protected]>

CPE_ID_VERSION defaults to {pkg}_VERSION by default.

When using custom tarballs or repo-revisions, this VERSION will contain either "custom" or the repository revision as its value.

This prevents tooling like CVE checkers, etc that use the show-info output to know what base version to check against.

To solve this add a config option to (optionally) allow overriding the CPE_ID_VERSION if needed.

---
 boot/optee-os/Config.in   | 11 +++++++++++
 boot/optee-os/optee-os.mk |  3 +++
 2 files changed, 14 insertions(+)
boot/optee-os/Config.in +11 -0
index af08375b9a..3e8b0a5a8f 100644
@@ -77,6 +77,17 @@ config BR2_TARGET_OPTEE_OS_CUSTOM_REPO_VERSION
 
 endif
 
+config BR2_TARGET_OPTEE_OS_CUSTOM_CPE_ID_VERSION
+	string "Set custom OP-TEE CPE_VERSION"
+	depends on BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL || BR2_TARGET_OPTEE_OS_CUSTOM_GIT
+	help
+	  CPE_ID_VERSION defaults to the package version, but when using
+	  custom tarballs or custom repository revisions, the version of
+	  that software is unknown and set to custom or the revision.
+
+	  Allow to set a separate CPE_ID_VERSION, that will generate
+	  more accurate CPE entries for the software-version used.
+
 config BR2_TARGET_OPTEE_OS_VERSION
 	string
 	default "4.9.0"		if BR2_TARGET_OPTEE_OS_LATEST
boot/optee-os/optee-os.mk +3 -0
index 1639597407..29d97eee53 100644
@@ -11,6 +11,9 @@ OPTEE_OS_LICENSE_FILES = $(call qstrip,$(BR2_TARGET_OPTEE_OS_LICENSE_FILES))
 OPTEE_OS_CPE_ID_PREFIX = cpe:2.3:o
 OPTEE_OS_CPE_ID_VENDOR = linaro
 OPTEE_OS_CPE_ID_PRODUCT = op-tee
+ifneq ($(BR2_TARGET_OPTEE_OS_CUSTOM_CPE_ID_VERSION),)
+OPTEE_OS_CPE_ID_VERSION = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_CPE_ID_VERSION))
+endif
 
 OPTEE_OS_INSTALL_STAGING = YES
 OPTEE_OS_INSTALL_IMAGES = YES
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH v2 2/3 boot/uboot: add option to override the CPE_ID_VERSION

In reply to Heiko Stuebner via buildroot

From: Heiko Stuebner <[email protected]>

CPE_ID_VERSION defaults to {pkg}_VERSION by default.

When using custom tarballs or repo-revisions, this VERSION will contain either "custom" or the repository revision as its value.

This prevents tooling like CVE checkers, etc that use the show-info output to know what base version to check against.

To solve this add a config option to (optionally) allow overriding the CPE_ID_VERSION if needed.

---
 boot/uboot/Config.in | 11 +++++++++++
 boot/uboot/uboot.mk  |  3 +++
 2 files changed, 14 insertions(+)
boot/uboot/Config.in +11 -0
index 3331b81e8c..410ad60e9c 100644
@@ -83,6 +83,17 @@ config BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION
 
 endif
 
+config BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION
+	string "Set custom U-Boot CPE_VERSION"
+	depends on BR2_TARGET_UBOOT_CUSTOM_TARBALL || BR2_TARGET_UBOOT_CUSTOM_GIT || BR2_TARGET_UBOOT_CUSTOM_HG || BR2_TARGET_UBOOT_CUSTOM_SVN
+	help
+	  CPE_ID_VERSION defaults to the package version, but when using
+	  custom tarballs or custom repository revisions, the version of
+	  that software is unknown and set to custom or the revision.
+
+	  Allow to set a separate CPE_ID_VERSION, that will generate
+	  more accurate CPE entries for the software-version used.
+
 config BR2_TARGET_UBOOT_VERSION
 	string
 	default "2026.01"	if BR2_TARGET_UBOOT_LATEST_VERSION
boot/uboot/uboot.mk +3 -0
index 5b3f46ac74..795bfd6c00 100644
@@ -11,6 +11,9 @@ UBOOT_LICENSE = GPL-2.0+
 UBOOT_LICENSE_FILES = $(call qstrip,$(BR2_TARGET_UBOOT_LICENSE_FILES))
 UBOOT_CPE_ID_VENDOR = denx
 UBOOT_CPE_ID_PRODUCT = u-boot
+ifneq ($(BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION),)
+UBOOT_CPE_ID_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION))
+endif
 
 UBOOT_INSTALL_IMAGES = YES
 
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v2 2/3] boot/uboot: add option to override the CPE_ID_VERSION

Hello Heiko,

A general comment to your series.

If your custom version is based on 'git' instead of a git commit hash you can use 'git describe' to have a something that should be parsable by tools that read CPE ids

Otherwise I have the following comment:

In reply of:

Quoted 23 lines

CPE_ID_VERSION defaults to {pkg}_VERSION by default.

When using custom tarballs or repo-revisions, this VERSION will contain either "custom" or the repository revision as its value.

This prevents tooling like CVE checkers, etc that use the show-info output to know what base version to check against.

To solve this add a config option to (optionally) allow overriding the CPE_ID_VERSION if needed.

---
 boot/uboot/Config.in | 11 +++++++++++
 boot/uboot/uboot.mk  |  3 +++
 2 files changed, 14 insertions(+)
boot/uboot/Config.in +0 -0
index 3331b81e8c..410ad60e9c 100644

boot/uboot/Config.in config BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION · line 87

Quoted 5 lines
boot/uboot/Config.in +2 -0
@@ -83,6 +83,17 @@ config BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION
 
 endif
 
+config BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION
+	string "Set custom U-Boot CPE_VERSION"

Here instead you can default to

```
default BR2_TARGET_UBOOT_VERSION
```
Quoted 17 lines
boot/uboot/Config.in +9 -0
+	depends on BR2_TARGET_UBOOT_CUSTOM_TARBALL || BR2_TARGET_UBOOT_CUSTOM_GIT || BR2_TARGET_UBOOT_CUSTOM_HG || BR2_TARGET_UBOOT_CUSTOM_SVN
+	help
+	  CPE_ID_VERSION defaults to the package version, but when using
+	  custom tarballs or custom repository revisions, the version of
+	  that software is unknown and set to custom or the revision.
+
+	  Allow to set a separate CPE_ID_VERSION, that will generate
+	  more accurate CPE entries for the software-version used.
+
 config BR2_TARGET_UBOOT_VERSION
 	string
 	default "2026.01"	if BR2_TARGET_UBOOT_LATEST_VERSION
boot/uboot/uboot.mk +0 -0
index 5b3f46ac74..795bfd6c00 100644

boot/uboot/uboot.mk UBOOT_LICENSE = GPL-2.0+ · line 16

Quoted 6 lines
boot/uboot/uboot.mk +3 -0
@@ -11,6 +11,9 @@ UBOOT_LICENSE = GPL-2.0+
 UBOOT_LICENSE_FILES = $(call qstrip,$(BR2_TARGET_UBOOT_LICENSE_FILES))
 UBOOT_CPE_ID_VENDOR = denx
 UBOOT_CPE_ID_PRODUCT = u-boot
+ifneq ($(BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION),)
+UBOOT_CPE_ID_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION))
+endif

This would allow to instead just do the following unconditionally:

UBOOT_CPE_ID_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION))

boot/uboot/uboot.mk UBOOT_LICENSE = GPL-2.0+ · line 18

Quoted 2 lines
boot/uboot/uboot.mk +0 -0
 UBOOT_INSTALL_IMAGES = YES

Best regards,
PERALE Thomas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH v2 2/3] boot/uboot: add option to override the CPE_ID_VERSION

Hi Thomas, Heiko,

Quoted 8 lines · Thomas Perale

Hello Heiko,

A general comment to your series.

If your custom version is based on 'git' instead of a git commit hash you can use 'git describe' to have a something that should be parsable by tools that read CPE ids

I'm not sure to understand what you're suggesting here? Is there something Buildroot can do here to avoid what's in this patch?

Quoted 64 lines

Otherwise I have the following comment:

In reply of:

Quoted 23 lines

CPE_ID_VERSION defaults to {pkg}_VERSION by default.

When using custom tarballs or repo-revisions, this VERSION will contain either "custom" or the repository revision as its value.

This prevents tooling like CVE checkers, etc that use the show-info output to know what base version to check against.

To solve this add a config option to (optionally) allow overriding the CPE_ID_VERSION if needed.

---
  boot/uboot/Config.in | 11 +++++++++++
  boot/uboot/uboot.mk  |  3 +++
  2 files changed, 14 insertions(+)
boot/uboot/Config.in +0 -0
index 3331b81e8c..410ad60e9c 100644

boot/uboot/Config.in config BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION · line 87

Quoted 5 lines
boot/uboot/Config.in +2 -0
@@ -83,6 +83,17 @@ config BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION
 
  endif
 
+config BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION
+	string "Set custom U-Boot CPE_VERSION"

Here instead you can default to

```
default BR2_TARGET_UBOOT_VERSION
```
Quoted 17 lines
boot/uboot/Config.in +9 -0
+	depends on BR2_TARGET_UBOOT_CUSTOM_TARBALL || BR2_TARGET_UBOOT_CUSTOM_GIT || BR2_TARGET_UBOOT_CUSTOM_HG || BR2_TARGET_UBOOT_CUSTOM_SVN
+	help
+	  CPE_ID_VERSION defaults to the package version, but when using
+	  custom tarballs or custom repository revisions, the version of
+	  that software is unknown and set to custom or the revision.
+
+	  Allow to set a separate CPE_ID_VERSION, that will generate
+	  more accurate CPE entries for the software-version used.
+
  config BR2_TARGET_UBOOT_VERSION
  	string
  	default "2026.01"	if BR2_TARGET_UBOOT_LATEST_VERSION
boot/uboot/uboot.mk +0 -0
index 5b3f46ac74..795bfd6c00 100644

boot/uboot/uboot.mk UBOOT_LICENSE = GPL-2.0+ · line 16

Quoted 6 lines
boot/uboot/uboot.mk +3 -0
@@ -11,6 +11,9 @@ UBOOT_LICENSE = GPL-2.0+
  UBOOT_LICENSE_FILES = $(call qstrip,$(BR2_TARGET_UBOOT_LICENSE_FILES))
  UBOOT_CPE_ID_VENDOR = denx
  UBOOT_CPE_ID_PRODUCT = u-boot
+ifneq ($(BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION),)
+UBOOT_CPE_ID_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION))
+endif

This would allow to instead just do the following unconditionally:

Quoted 2 lines

UBOOT_CPE_ID_VERSION = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_CPE_ID_VERSION))

I like this a lot. Maybe we should even remove CUSTOM_ from the symbol name?

Cheers,
Quentin
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

PATCH v2 3/3 linux: add option to override the CPE_ID_VERSION

In reply to Heiko Stuebner via buildroot

From: Heiko Stuebner <[email protected]>

CPE_ID_VERSION defaults to {pkg}_VERSION by default.

When using custom tarballs or repo-revisions, this VERSION will contain either "custom" or the repository revision as its value.

This prevents tooling like CVE checkers, etc that use the show-info output to know what base version to check against.

To solve this add a config option to (optionally) allow overriding the CPE_ID_VERSION if needed.

---
 linux/Config.in | 12 ++++++++++++
 linux/linux.mk  |  3 +++
 2 files changed, 15 insertions(+)
linux/Config.in +12 -0
index 44f8b08e71..84f7abddab 100644
@@ -139,6 +139,18 @@ config BR2_LINUX_KERNEL_CUSTOM_REPO_GIT_SUBMODULES
 	help
 	  Include git submodules in the kernel source tree.
 
+config BR2_LINUX_KERNEL_CUSTOM_CPE_ID_VERSION
+	string "Set custom Linux-Kernel CPE_ID_VERSION"
+	depends on BR2_LINUX_KERNEL_CUSTOM_TARBALL || BR2_LINUX_KERNEL_CUSTOM_GIT || \
+		   BR2_LINUX_KERNEL_CUSTOM_HG || BR2_LINUX_KERNEL_CUSTOM_SVN
+	help
+	  CPE_ID_VERSION defaults to the package version, but when using
+	  custom tarballs or custom repository revisions, the version of
+	  that software is unknown and set to custom or the revision.
+
+	  Allow to set a separate CPE_ID_VERSION, that will generate
+	  more accurate CPE entries for the software-version used.
+
 config BR2_LINUX_KERNEL_VERSION
 	string
 	default "6.19.8" if BR2_LINUX_KERNEL_LATEST_VERSION
linux/linux.mk +3 -0
index c61089bfe0..35418373df 100644
@@ -11,6 +11,9 @@ LINUX_LICENSE_FILES = $(call qstrip,$(BR2_LINUX_KERNEL_LICENSE_FILES))
 LINUX_CPE_ID_VENDOR = linux
 LINUX_CPE_ID_PRODUCT = linux_kernel
 LINUX_CPE_ID_PREFIX = cpe:2.3:o
+ifneq ($(BR2_LINUX_KERNEL_CUSTOM_CPE_ID_VERSION),)
+LINUX_CPE_ID_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_CPE_ID_VERSION))
+endif
 
 # Compute LINUX_SOURCE and LINUX_SITE from the configuration
 ifeq ($(BR2_LINUX_KERNEL_CUSTOM_TARBALL),y)
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot