* [PATCH 1/2] improve_kernel_cve_report: stop when debug sources list no files
@ 2026-12-03 5:33 Prasanth R
2026-12-03 5:33 ` [PATCH 2/2] improve_kernel_cve_report: use the zstd tool if zstandard is missing Prasanth R
0 siblings, 1 reply; 4+ messages in thread
From: Prasanth R @ 2026-12-03 5:33 UTC (permalink / raw)
To: openembedded-core; +Cc: Daniel Turull, Prasanth R
A kernel built without debug info (CONFIG_DEBUG_INFO_NONE) has only empty
entries in its debugsources file, and the script fails with an IndexError.
Skipping them is not enough: with no compiled files left, every CVE would
be ignored as not applicable. Skip entries without a path and stop with a
clear message if nothing is left.
Found with linux-fslc for imx6qdlsabresd.
AI-Generated: Uses Claude
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
scripts/contrib/improve_kernel_cve_report.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/contrib/improve_kernel_cve_report.py b/scripts/contrib/improve_kernel_cve_report.py
index 41cbc1e222..76ba54d835 100755
--- a/scripts/contrib/improve_kernel_cve_report.py
+++ b/scripts/contrib/improve_kernel_cve_report.py
@@ -252,8 +252,14 @@ def read_debugsources(file_path):
# We need to remove one level from the debug sources
for source_list in json_data.values():
for source in source_list:
+ # entries are empty if the kernel has no debug info
+ if "/" not in source:
+ continue
src = source.split("/",1)[1]
cfiles.add(src)
+ if not cfiles:
+ sys.exit(f"{file_path} lists no compiled sources: "
+ "is the kernel built without debug info (CONFIG_DEBUG_INFO)?")
return cfiles
def check_kernel_compiled_files(compiled_files, cve_info):
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] improve_kernel_cve_report: use the zstd tool if zstandard is missing
2026-12-03 5:33 [PATCH 1/2] improve_kernel_cve_report: stop when debug sources list no files Prasanth R
@ 2026-12-03 5:33 ` Prasanth R
2026-12-04 13:26 ` Paul Barker
0 siblings, 1 reply; 4+ messages in thread
From: Prasanth R @ 2026-12-03 5:33 UTC (permalink / raw)
To: openembedded-core; +Cc: Daniel Turull, Prasanth R
The python zstandard module is not installed on all build hosts, but the
zstd tool is a Yocto host requirement. Fall back to 'zstd -dc' when the
module is not available.
AI-Generated: Uses Claude
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
scripts/contrib/improve_kernel_cve_report.py | 33 +++++++++++---------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/scripts/contrib/improve_kernel_cve_report.py b/scripts/contrib/improve_kernel_cve_report.py
index 76ba54d835..3446527654 100755
--- a/scripts/contrib/improve_kernel_cve_report.py
+++ b/scripts/contrib/improve_kernel_cve_report.py
@@ -240,23 +240,28 @@ def read_debugsources(file_path):
'''
Read zstd file from pkgdata to extract sources
'''
- import zstandard as zstd
import itertools
# Decompress the .zst file
cfiles = set()
- with open(file_path, 'rb') as fh:
- dctx = zstd.ZstdDecompressor()
- with dctx.stream_reader(fh) as reader:
- decompressed_bytes = reader.read()
- json_data = json.loads(decompressed_bytes)
- # We need to remove one level from the debug sources
- for source_list in json_data.values():
- for source in source_list:
- # entries are empty if the kernel has no debug info
- if "/" not in source:
- continue
- src = source.split("/",1)[1]
- cfiles.add(src)
+ try:
+ import zstandard as zstd
+ with open(file_path, 'rb') as fh:
+ with zstd.ZstdDecompressor().stream_reader(fh) as reader:
+ decompressed_bytes = reader.read()
+ except ImportError:
+ # zstd is a Yocto host tool: use it if the python module is missing
+ import subprocess
+ decompressed_bytes = subprocess.run(["zstd", "-dc", file_path],
+ check=True, capture_output=True).stdout
+ json_data = json.loads(decompressed_bytes)
+ # We need to remove one level from the debug sources
+ for source_list in json_data.values():
+ for source in source_list:
+ # entries are empty if the kernel has no debug info
+ if "/" not in source:
+ continue
+ src = source.split("/",1)[1]
+ cfiles.add(src)
if not cfiles:
sys.exit(f"{file_path} lists no compiled sources: "
"is the kernel built without debug info (CONFIG_DEBUG_INFO)?")
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] improve_kernel_cve_report: use the zstd tool if zstandard is missing
2026-12-03 5:33 ` [PATCH 2/2] improve_kernel_cve_report: use the zstd tool if zstandard is missing Prasanth R
@ 2026-12-04 13:26 ` Paul Barker
2026-12-04 13:42 ` Prasanth R
0 siblings, 1 reply; 4+ messages in thread
From: Paul Barker @ 2026-12-04 13:26 UTC (permalink / raw)
To: Prasanth R, openembedded-core; +Cc: Daniel Turull
On Thu Dec 3, 2026 at 5:33 AM GMT, Prasanth R wrote:
> The python zstandard module is not installed on all build hosts, but the
> zstd tool is a Yocto host requirement. Fall back to 'zstd -dc' when the
> module is not available.
>
> AI-Generated: Uses Claude
> Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
Hi Prasanth,
Having two ways of decompressing data here gives us two code paths which
may fail in different ways, and which aren't both covered by testing. I
don't expect the Python zstandard module to be any faster/better than
the external command, so there's no good justification for having both.
Should we always run zstd as an external command? That would give us one
way of doing things that should always work.
Best regards,
--
Paul Barker
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] improve_kernel_cve_report: use the zstd tool if zstandard is missing
2026-12-04 13:26 ` Paul Barker
@ 2026-12-04 13:42 ` Prasanth R
0 siblings, 0 replies; 4+ messages in thread
From: Prasanth R @ 2026-12-04 13:42 UTC (permalink / raw)
To: paul; +Cc: openembedded-core, daniel.turull
On Fri Dec 4, 2026 at 1:26 PM GMT, Paul Barker wrote:
> Should we always run zstd as an external command? That would give us one
> way of doing things that should always work.
Hi Paul,
Agreed. I will send v2, which always runs zstd as an external command.
Thanks,
Prasanth
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-04 13:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 5:33 [PATCH 1/2] improve_kernel_cve_report: stop when debug sources list no files Prasanth R
2026-12-03 5:33 ` [PATCH 2/2] improve_kernel_cve_report: use the zstd tool if zstandard is missing Prasanth R
2026-12-04 13:26 ` Paul Barker
2026-12-04 13:42 ` Prasanth R
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.