From 8d3f288df5a2a04ccdcf2109286b4fe8177dc52f Mon Sep 17 00:00:00 2001 From: Ondrej Mosnacek Date: Sat, 27 Mar 2021 14:26:36 +0100 Subject: [PATCH] Add a patch to fix fuzz tests Add a pending patch to fix fuzz tests hanging infinitely: https://github.com/smuellerDD/libkcapi/pull/110 Signed-off-by: Ondrej Mosnacek --- 001-fix-fuzz-test.patch | 37 +++++++++++++++++++++++++++++++++++++ libkcapi.spec | 3 +++ 2 files changed, 40 insertions(+) create mode 100644 001-fix-fuzz-test.patch diff --git a/001-fix-fuzz-test.patch b/001-fix-fuzz-test.patch new file mode 100644 index 0000000..c1fdbc5 --- /dev/null +++ b/001-fix-fuzz-test.patch @@ -0,0 +1,37 @@ +From e8c22fe01c6dd46399396694cd1d72a6988dc287 Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Sat, 27 Mar 2021 13:46:45 +0100 +Subject: [PATCH] kcapi: Fix hang in fuzz tests with recent kernels + +After kernel commit f3c802a1f300 ("crypto: algif_aead - Only wake up +when..."), the fuzz tests hang indefinitely, because they request more +output data than the operation can produce. Fix this by requesting at +most the expected size of the output data. + +Signed-off-by: Ondrej Mosnacek +--- + test/kcapi-main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/kcapi-main.c b/test/kcapi-main.c +index 64e466c..975e8d1 100644 +--- a/test/kcapi-main.c ++++ b/test/kcapi-main.c +@@ -380,7 +380,7 @@ static int fuzz_cipher(struct kcapi_cavs *cavs_test, unsigned long flags, + } + + for (i = 0; i < sizeof(indata); i++) { +- unsigned int outlen = sizeof(outdata); ++ unsigned int outlen = i; + uint8_t *out = outdata; + uint8_t *iv = indata; + uint8_t *in = indata; +@@ -474,7 +474,7 @@ static int fuzz_aead(struct kcapi_cavs *cavs_test, unsigned long flags, + } + + for (i = 0; i < sizeof(indata); i++) { +- unsigned int outlen = sizeof(outdata); ++ unsigned int outlen = i; + uint8_t *out = outdata; + uint8_t *iv = indata; + uint8_t *in = indata; diff --git a/libkcapi.spec b/libkcapi.spec index 0b325a8..6a0c2e5 100644 --- a/libkcapi.spec +++ b/libkcapi.spec @@ -135,6 +135,8 @@ Source1: https://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc Source2: sha512hmac-openssl.sh Source3: fipshmac-openssl.sh +Patch001: %{giturl}/pull/110.patch#/001-fix-fuzz-test.patch + BuildRequires: bash BuildRequires: coreutils BuildRequires: gcc @@ -514,6 +516,7 @@ popd - Update to upstream version 1.2.1 - Remove patch fix MSG_MORE uasge as it is added upstream - Remove cppcheck dependency for rhel bz#1931518 +- Add a patch to fix fuzz tests * Tue Jan 26 2021 Fedora Release Engineering - 1.2.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild