Rebase to new stable branch version 1.30.2

resolves: rhbz#2059289

Skip vsock tests unless the vsock_loopback module is loaded (2069558)
This commit is contained in:
Richard W.M. Jones 2022-04-04 13:10:21 +01:00
parent 4a8d800b4f
commit 3ebd7154dd
3 changed files with 8 additions and 78 deletions

View File

@ -1,71 +0,0 @@
From 3578c005c8a2f479eb223bb89f7b0fba22d13766 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 22 Mar 2022 11:04:56 +0000
Subject: [PATCH] vddk: Don't use uninitialized values when computing preferred
block size
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit 63d2dd2eb2 ("vddk: Export block size information for this
plugin") tried to calculate the preferred block size from the logical
and physical sector size reported by VDDK. Unfortunately VDDK < 7s
VixDiskLib_GetInfo API returns a struct which does not contain
these fields at all. We knew about this already because the
debug code does not print them, but the block size code uses
them regardless of the VDDK version.
The practical result of this error was that sometimes (depending on
existing contents of memory) you would see the error:
nbdkit: vddk[1]: error: plugin must set preferred block size to a power of 2
Fix this by only using the fields when VDDK >= 7, and in earlier
versions assuming VDDKs normal sector size.
Reported-by: Xiaodai Wang
Fixes: commit 63d2dd2eb2c9980a07841fe84ec16844085a59c3
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2066655
(cherry picked from commit 31bc5322b179545bef827022e1ae3b7859387b1b)
---
plugins/vddk/vddk.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 5d31b073..51ef8f33 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -855,6 +855,7 @@ vddk_block_size (void *handle,
{
struct vddk_handle *h = handle;
VixDiskLibInfo *info;
+ uint32_t logicalSectorSize, physicalSectorSize;
struct command info_cmd = { .type = INFO, .ptr = &info };
if (send_command_and_wait (h, &info_cmd) == -1)
@@ -862,8 +863,20 @@ vddk_block_size (void *handle,
/* VDDK can only serve whole 512 byte sectors. */
*minimum = VIXDISKLIB_SECTOR_SIZE;
- *preferred = MAX (MAX (info->logicalSectorSize, info->physicalSectorSize),
- 4096);
+
+ /* The logicalSectorSize and physicalSectorSize fields are only
+ * present in VDDK >= 7. In earlier versions they will not be
+ * initialized and contain random values (beyond the end of the
+ * returned structure). So compute sector sizes with this in mind.
+ */
+ logicalSectorSize = physicalSectorSize = VIXDISKLIB_SECTOR_SIZE;
+ if (library_version >= 7) {
+ logicalSectorSize = info->logicalSectorSize;
+ physicalSectorSize = info->physicalSectorSize;
+ }
+
+ *preferred = MAX (MAX (logicalSectorSize, physicalSectorSize), 4096);
+
*maximum = 0xffffffff;
VDDK_CALL_START (VixDiskLib_FreeInfo, "info")
--
2.31.1

View File

@ -52,8 +52,8 @@ ExclusiveArch: x86_64
%global source_directory 1.30-stable
Name: nbdkit
Version: 1.30.1
Release: 2%{?dist}
Version: 1.30.2
Release: 1%{?dist}
Summary: NBD server
License: BSD
@ -78,7 +78,7 @@ Source3: copy-patches.sh
# https://gitlab.com/nbdkit/nbdkit/-/commits/rhel-9.1/
# Patches.
Patch0001: 0001-vddk-Don-t-use-uninitialized-values-when-computing-p.patch
# (none)
# For automatic RPM Provides generation.
# See: https://rpm-software-management.github.io/rpm/manual/dependency_generators.html
@ -1178,8 +1178,8 @@ export LIBGUESTFS_TRACE=1
%changelog
* Tue Mar 22 2022 Richard W.M. Jones <rjones@redhat.com> - 1.30.1-2
- Rebase to new stable branch version 1.30.1
* Mon Apr 04 2022 Richard W.M. Jones <rjones@redhat.com> - 1.30.2-1
- Rebase to new stable branch version 1.30.2
resolves: rhbz#2059289
- Add automatic provides generator and subpackage nbdkit-srpm-macros
resolves: rhbz#2059291
@ -1187,6 +1187,7 @@ export LIBGUESTFS_TRACE=1
- Fix license of bash-completion subpackage
- vddk: Fix use of uninitialized memory when computing block size
resolves: rhbz#2066655
- Skip vsock tests unless the vsock_loopback module is loaded (2069558)
* Mon Jan 24 2022 Richard W.M. Jones <rjones@redhat.com> - 1.28.5-1
- Rebase to new stable branch version 1.28.5

View File

@ -1,2 +1,2 @@
SHA512 (nbdkit-1.30.1.tar.gz) = 433016b43e192fb07697af0b357aa817b46af811494762a8d38a5d7d8edfeb155451b7e1a35062dda10cc2bf9b19865a3faa5b781bd8cf1a121e7088582b586d
SHA512 (nbdkit-1.30.1.tar.gz.sig) = 7148c52779f345bfa515f1dfb38ed8e6efdc8b89e8d7a51b966c3b6fb5ffe48f74d114038ef3215d5ca7c3a206c11cc3946ebc90971647a52e71fdfaed902ee8
SHA512 (nbdkit-1.30.2.tar.gz) = 84da92005bbb59a860c9ba5a88082d859c9dd4f9db5c81d8760e9d6925e10d80d27de78be9391113bf715d16de7726594b5b803512cd8b59ce14ec135fc4b09d
SHA512 (nbdkit-1.30.2.tar.gz.sig) = c64ccdbc25f56626360aa812af330e33f26e6954415b93976f5a3d58808affdc94efa6e309066b23dbfd354192c4693a408b79aa583a6f5e84ab1c2ef406179e