From f05aa13b32404376f9c673604205c37693715469 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 16 Apr 2024 15:12:36 +0200 Subject: [PATCH] msg-filter: tweak kernel path fixup for z-stream releases The original rule was able to translate: `kernel-4.18.0-552.el8/linux-4.18.0-552.el8.x86_64/` -> `kernel-4.18.0-552.el8/` ... but it did not work for z-stream releases, where the paths are unnecessarily inconsistent (`el8_9` on the first level vs. `el8` on the second level): `kernel-4.18.0-513.5.1.el8_9/linux-4.18.0-513.5.1.el8.x86_64/` Related: https://issues.redhat.com/browse/OSH-563 Closes: https://github.com/csutils/csdiff/pull/171 --- src/lib/msg-filter.cc | 2 +- tests/csdiff/CMakeLists.txt | 1 + .../csdiff/diff-misc/22-kernel-zstream-path-add-z.err | 0 tests/csdiff/diff-misc/22-kernel-zstream-path-add.err | 0 .../csdiff/diff-misc/22-kernel-zstream-path-fix-z.err | 0 tests/csdiff/diff-misc/22-kernel-zstream-path-fix.err | 0 tests/csdiff/diff-misc/22-kernel-zstream-path-new.err | 11 +++++++++++ tests/csdiff/diff-misc/22-kernel-zstream-path-old.err | 11 +++++++++++ 8 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/csdiff/diff-misc/22-kernel-zstream-path-add-z.err create mode 100644 tests/csdiff/diff-misc/22-kernel-zstream-path-add.err create mode 100644 tests/csdiff/diff-misc/22-kernel-zstream-path-fix-z.err create mode 100644 tests/csdiff/diff-misc/22-kernel-zstream-path-fix.err create mode 100644 tests/csdiff/diff-misc/22-kernel-zstream-path-new.err create mode 100644 tests/csdiff/diff-misc/22-kernel-zstream-path-old.err diff --git a/src/lib/msg-filter.cc b/src/lib/msg-filter.cc index 4450b74d..c1fd57d8 100644 --- a/src/lib/msg-filter.cc +++ b/src/lib/msg-filter.cc @@ -66,7 +66,7 @@ struct MsgFilter::Private { TSubstMap fileSubsts; const std::string strKrn = "^[a-zA-Z+]+"; - const RE reKrn = RE(strKrn); + const RE reKrn = RE(strKrn + /* convert el8_9 -> el8 */ "|_[0-9]+$"); const RE reDir = RE("^([^:]*/)"); const RE reFile = RE("[^/]+$"); const RE rePath = RE("^(?:/builddir/build/BUILD/)?([^/]+)/(.*)(\\.[ly])?$"); diff --git a/tests/csdiff/CMakeLists.txt b/tests/csdiff/CMakeLists.txt index 0335545e..77b8cc2d 100644 --- a/tests/csdiff/CMakeLists.txt +++ b/tests/csdiff/CMakeLists.txt @@ -85,6 +85,7 @@ test_csdiff(diff-misc 17-cov-parser-key-event) test_csdiff(diff-misc 18-cov-parser-key-event) test_csdiff(diff-misc 19-cov-parser-key-event) test_csdiff(diff-misc 21-kernel-shell-code) +test_csdiff(diff-misc 22-kernel-zstream-path) test_csdiff(diff-misc 23-cov-parser-key-event) add_subdirectory(filter-file) diff --git a/tests/csdiff/diff-misc/22-kernel-zstream-path-add-z.err b/tests/csdiff/diff-misc/22-kernel-zstream-path-add-z.err new file mode 100644 index 00000000..e69de29b diff --git a/tests/csdiff/diff-misc/22-kernel-zstream-path-add.err b/tests/csdiff/diff-misc/22-kernel-zstream-path-add.err new file mode 100644 index 00000000..e69de29b diff --git a/tests/csdiff/diff-misc/22-kernel-zstream-path-fix-z.err b/tests/csdiff/diff-misc/22-kernel-zstream-path-fix-z.err new file mode 100644 index 00000000..e69de29b diff --git a/tests/csdiff/diff-misc/22-kernel-zstream-path-fix.err b/tests/csdiff/diff-misc/22-kernel-zstream-path-fix.err new file mode 100644 index 00000000..e69de29b diff --git a/tests/csdiff/diff-misc/22-kernel-zstream-path-new.err b/tests/csdiff/diff-misc/22-kernel-zstream-path-new.err new file mode 100644 index 00000000..30898a8b --- /dev/null +++ b/tests/csdiff/diff-misc/22-kernel-zstream-path-new.err @@ -0,0 +1,11 @@ +Error: UNINIT (CWE-457): +kernel-4.18.0-552.el8/linux-4.18.0-552.el8.x86_64/arch/x86/crypto/chacha20_glue.c:71:2: var_decl: Declaring variable "walk" without initializer. +kernel-4.18.0-552.el8/linux-4.18.0-552.el8.x86_64/arch/x86/crypto/chacha20_glue.c:74:2: path: Condition "__cond", taking false branch. +kernel-4.18.0-552.el8/linux-4.18.0-552.el8.x86_64/arch/x86/crypto/chacha20_glue.c:77:2: path: Condition "req->cryptlen <= 64", taking false branch. +kernel-4.18.0-552.el8/linux-4.18.0-552.el8.x86_64/arch/x86/crypto/chacha20_glue.c:77:2: path: Condition "!may_use_simd()", taking false branch. +kernel-4.18.0-552.el8/linux-4.18.0-552.el8.x86_64/arch/x86/crypto/chacha20_glue.c:80:2: uninit_use_in_call: Using uninitialized value "walk.flags" when calling "skcipher_walk_virt". +# 78| return crypto_chacha20_crypt(req); +# 79| +# 80|-> err = skcipher_walk_virt(&walk, req, true); +# 81| +# 82| crypto_chacha20_init(state, ctx, walk.iv); diff --git a/tests/csdiff/diff-misc/22-kernel-zstream-path-old.err b/tests/csdiff/diff-misc/22-kernel-zstream-path-old.err new file mode 100644 index 00000000..1ad84b07 --- /dev/null +++ b/tests/csdiff/diff-misc/22-kernel-zstream-path-old.err @@ -0,0 +1,11 @@ +Error: UNINIT (CWE-457): +kernel-4.18.0-513.5.1.el8_9/linux-4.18.0-513.5.1.el8.x86_64/arch/x86/crypto/chacha20_glue.c:71: var_decl: Declaring variable "walk" without initializer. +kernel-4.18.0-513.5.1.el8_9/linux-4.18.0-513.5.1.el8.x86_64/arch/x86/crypto/chacha20_glue.c:74: path: Condition "__cond", taking false branch. +kernel-4.18.0-513.5.1.el8_9/linux-4.18.0-513.5.1.el8.x86_64/arch/x86/crypto/chacha20_glue.c:77: path: Condition "req->cryptlen <= 64", taking false branch. +kernel-4.18.0-513.5.1.el8_9/linux-4.18.0-513.5.1.el8.x86_64/arch/x86/crypto/chacha20_glue.c:77: path: Condition "!may_use_simd()", taking false branch. +kernel-4.18.0-513.5.1.el8_9/linux-4.18.0-513.5.1.el8.x86_64/arch/x86/crypto/chacha20_glue.c:80: uninit_use_in_call: Using uninitialized value "walk.flags" when calling "skcipher_walk_virt". +# 78| return crypto_chacha20_crypt(req); +# 79| +# 80|-> err = skcipher_walk_virt(&walk, req, true); +# 81| +# 82| crypto_chacha20_init(state, ctx, walk.iv);