62e12e062c
Applu 4 patches that fix various minor issues: - v29~5 "libkmod: fix an overflow with wrong modules.builtin.modinfo" - v31~29 "libkmod: do not crash on unknown signature algorithm" - v31~18 "libkmod: error out on unknown hash algorithm" - v33~1 "libkmod: avoid undefined behaviour in libkmod-builtin.c:get_string" * 0001-libkmod-avoid-undefined-behaviour-in-libkmod-builtin.patch: New file. * 0001-libkmod-do-not-crash-on-unknown-signature-algorithm.patch: Likewise. * 0001-libkmod-error-out-on-unknown-hash-algorithm.patch: Likewise. * 0001-libkmod-fix-an-overflow-with-wrong-modules.builtin.m.patch: Likewise. * kmod.spec (Release): Bump to 10. (Patch02, Patch03, Patch04, Patch05): New patches. (%changelog): New record. Resolves: RHEL-34073 Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
From b9605c63b859adfffc0b4b9420d720aa323b90e9 Mon Sep 17 00:00:00 2001
|
|
From: Emil Velikov <emil.velikov@collabora.com>
|
|
Date: Mon, 6 Feb 2023 14:32:59 +0000
|
|
Subject: [PATCH] libkmod: error out on unknown hash algorithm
|
|
|
|
Currently if we see unknown algorithm, we'll do an OOB read in
|
|
pkey_hash_algo. This can happen for example if OPENSSL_NO_SM3 is set and
|
|
the kernel module uses a SM3 hash.
|
|
|
|
Cc: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
|
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
|
|
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
|
|
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
|
|
---
|
|
libkmod/libkmod-signature.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
|
|
index 092f396..b749a81 100644
|
|
--- a/libkmod/libkmod-signature.c
|
|
+++ b/libkmod/libkmod-signature.c
|
|
@@ -219,6 +219,7 @@ static bool fill_pkcs7(const char *mem, off_t size,
|
|
unsigned char *key_id_str;
|
|
struct pkcs7_private *pvt;
|
|
const char *issuer_str;
|
|
+ int hash_algo;
|
|
|
|
size -= sig_len;
|
|
pkcs7_raw = mem + size;
|
|
@@ -277,7 +278,10 @@ static bool fill_pkcs7(const char *mem, off_t size,
|
|
|
|
X509_ALGOR_get0(&o, NULL, NULL, dig_alg);
|
|
|
|
- sig_info->hash_algo = pkey_hash_algo[obj_to_hash_algo(o)];
|
|
+ hash_algo = obj_to_hash_algo(o);
|
|
+ if (hash_algo < 0)
|
|
+ goto err3;
|
|
+ sig_info->hash_algo = pkey_hash_algo[hash_algo];
|
|
// hash algo has not been recognized
|
|
if (sig_info->hash_algo == NULL)
|
|
goto err3;
|
|
--
|
|
2.13.6
|
|
|