Manually merge fedora/rawhide

related: rhbz#1950630

Add gating test for RHEL 9
resolves: rhbz#1950599
This commit is contained in:
Richard W.M. Jones 2021-06-02 12:36:07 +01:00
parent ebaacbcabd
commit 0ef70195b5
10 changed files with 13 additions and 576 deletions

View File

@ -1,74 +0,0 @@
From 8b20bbd329c07941f3e4aa00e14c05ed27b25435 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Mar 2021 22:20:49 +0000
Subject: [PATCH 1/6] copy: Stable sort in tests.
When running the tests in Koji they behaved differently from running
locally (under a UTF-8 locale). This turned out to be a difference in
sorting under the different locales.
Thanks: Eric Blake
---
copy/copy-sparse-request-size.sh | 2 +-
copy/copy-sparse.sh | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/copy/copy-sparse-request-size.sh b/copy/copy-sparse-request-size.sh
index b539f5e..f2e2b61 100755
--- a/copy/copy-sparse-request-size.sh
+++ b/copy/copy-sparse-request-size.sh
@@ -50,7 +50,7 @@ $VG nbdcopy --no-extents -S 0 --request-size=1048576 -- \
trim=" echo \$@ >> $out " \
zero=" echo \$@ >> $out " ]
-sort -n -o $out $out
+LC_ALL=C sort -n -o $out $out
echo Output:
cat $out
diff --git a/copy/copy-sparse.sh b/copy/copy-sparse.sh
index c43b41a..5f12bad 100755
--- a/copy/copy-sparse.sh
+++ b/copy/copy-sparse.sh
@@ -50,7 +50,7 @@ $VG nbdcopy -S 0 -- \
# Order of the output could vary because requests are sent in
# parallel.
-sort -n -o $out $out
+LC_ALL=C sort -n -o $out $out
echo Output:
cat $out
@@ -65,8 +65,8 @@ zero 134184960 4160749568 may_trim
zero 134184960 939524096 may_trim
zero 134217728 1073741824 may_trim
zero 134217728 1207959552 may_trim
-zero 134217728 1342177280 may_trim
zero 134217728 134217728 may_trim
+zero 134217728 1342177280 may_trim
zero 134217728 1476395008 may_trim
zero 134217728 1610612736 may_trim
zero 134217728 1744830464 may_trim
@@ -76,8 +76,8 @@ zero 134217728 2147483648 may_trim
zero 134217728 2281701376 may_trim
zero 134217728 2415919104 may_trim
zero 134217728 2550136832 may_trim
-zero 134217728 2684354560 may_trim
zero 134217728 268435456 may_trim
+zero 134217728 2684354560 may_trim
zero 134217728 2818572288 may_trim
zero 134217728 2952790016 may_trim
zero 134217728 3087007744 may_trim
@@ -87,8 +87,8 @@ zero 134217728 3489660928 may_trim
zero 134217728 3623878656 may_trim
zero 134217728 3758096384 may_trim
zero 134217728 3892314112 may_trim
-zero 134217728 4026531840 may_trim
zero 134217728 402653184 may_trim
+zero 134217728 4026531840 may_trim
zero 134217728 536870912 may_trim
zero 134217728 671088640 may_trim
zero 134217728 805306368 may_trim" ]; then
--
2.29.0.rc2

View File

@ -1,39 +0,0 @@
From 40308a005eaa6b2e8f98da8952d0c0cacc51efde Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Fri, 12 Mar 2021 17:00:58 -0600
Subject: [PATCH] security: Document assignment of CVE-2021-20286
Now that we finally have a CVE number, it's time to document
the problem (it's low severity, but still a denial of service).
Fixes: fb4440de9cc7 (opt_go: Tolerate unplanned server death)
---
docs/libnbd-security.pod | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/docs/libnbd-security.pod b/docs/libnbd-security.pod
index 876ef2f..3c994de 100644
--- a/docs/libnbd-security.pod
+++ b/docs/libnbd-security.pod
@@ -22,6 +22,12 @@ L<https://www.redhat.com/archives/libguestfs/2019-September/msg00128.html>
See the full announcement here:
L<https://www.redhat.com/archives/libguestfs/2019-October/msg00060.html>
+=head2 CVE-2021-20286
+denial of service when using L<nbd_set_opt_mode(3)>
+
+See the full announcement here:
+L<https://listman.redhat.com/archives/libguestfs/2021-March/msg00092.html>
+
=head1 SEE ALSO
L<libnbd(3)>.
@@ -34,4 +40,4 @@ Richard W.M. Jones
=head1 COPYRIGHT
-Copyright (C) 2019 Red Hat Inc.
+Copyright (C) 2019-2021 Red Hat Inc.
--
2.29.0.rc2

View File

@ -1,170 +0,0 @@
From bae7c41a5126c56da4ee77bce39955036fca8b5f Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Tue, 2 Mar 2021 16:31:39 -0600
Subject: [PATCH 2/6] copy: Nicer sort
Tell sort where the numbers live, so we can get columns in ascending
numeric order. Improves 8b20bbd329.
---
copy/copy-sparse-no-extents.sh | 12 ++++++------
copy/copy-sparse-request-size.sh | 20 ++++++++++----------
copy/copy-sparse.sh | 18 +++++++++---------
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/copy/copy-sparse-no-extents.sh b/copy/copy-sparse-no-extents.sh
index cdc132b..4dc5c88 100755
--- a/copy/copy-sparse-no-extents.sh
+++ b/copy/copy-sparse-no-extents.sh
@@ -50,22 +50,21 @@ $VG nbdcopy --no-extents -S 0 -- \
trim=" echo \$@ >> $out " \
zero=" echo \$@ >> $out " ]
-sort -n -o $out $out
+LC_ALL=C sort -k1,1 -k2,2n -k3,3n -o $out $out
echo Output:
cat $out
if [ "$(cat $out)" != "pwrite 33554432 0
+pwrite 33554432 33554432
+pwrite 33554432 67108864
pwrite 33554432 100663296
-pwrite 33554432 1006632960
-pwrite 33554432 1040187392
pwrite 33554432 134217728
pwrite 33554432 167772160
pwrite 33554432 201326592
pwrite 33554432 234881024
pwrite 33554432 268435456
pwrite 33554432 301989888
-pwrite 33554432 33554432
pwrite 33554432 335544320
pwrite 33554432 369098752
pwrite 33554432 402653184
@@ -76,7 +75,6 @@ pwrite 33554432 536870912
pwrite 33554432 570425344
pwrite 33554432 603979776
pwrite 33554432 637534208
-pwrite 33554432 67108864
pwrite 33554432 671088640
pwrite 33554432 704643072
pwrite 33554432 738197504
@@ -86,7 +84,9 @@ pwrite 33554432 838860800
pwrite 33554432 872415232
pwrite 33554432 905969664
pwrite 33554432 939524096
-pwrite 33554432 973078528" ]; then
+pwrite 33554432 973078528
+pwrite 33554432 1006632960
+pwrite 33554432 1040187392" ]; then
echo "$0: output does not match expected"
exit 1
fi
diff --git a/copy/copy-sparse-request-size.sh b/copy/copy-sparse-request-size.sh
index f2e2b61..78a066a 100755
--- a/copy/copy-sparse-request-size.sh
+++ b/copy/copy-sparse-request-size.sh
@@ -50,13 +50,21 @@ $VG nbdcopy --no-extents -S 0 --request-size=1048576 -- \
trim=" echo \$@ >> $out " \
zero=" echo \$@ >> $out " ]
-LC_ALL=C sort -n -o $out $out
+LC_ALL=C sort -k1,1 -k2,2n -k3,3n -o $out $out
echo Output:
cat $out
if [ "$(cat $out)" != "pwrite 1048576 0
pwrite 1048576 1048576
+pwrite 1048576 2097152
+pwrite 1048576 3145728
+pwrite 1048576 4194304
+pwrite 1048576 5242880
+pwrite 1048576 6291456
+pwrite 1048576 7340032
+pwrite 1048576 8388608
+pwrite 1048576 9437184
pwrite 1048576 10485760
pwrite 1048576 11534336
pwrite 1048576 12582912
@@ -67,7 +75,6 @@ pwrite 1048576 16777216
pwrite 1048576 17825792
pwrite 1048576 18874368
pwrite 1048576 19922944
-pwrite 1048576 2097152
pwrite 1048576 20971520
pwrite 1048576 22020096
pwrite 1048576 23068672
@@ -78,15 +85,8 @@ pwrite 1048576 27262976
pwrite 1048576 28311552
pwrite 1048576 29360128
pwrite 1048576 30408704
-pwrite 1048576 3145728
pwrite 1048576 31457280
-pwrite 1048576 32505856
-pwrite 1048576 4194304
-pwrite 1048576 5242880
-pwrite 1048576 6291456
-pwrite 1048576 7340032
-pwrite 1048576 8388608
-pwrite 1048576 9437184" ]; then
+pwrite 1048576 32505856" ]; then
echo "$0: output does not match expected"
exit 1
fi
diff --git a/copy/copy-sparse.sh b/copy/copy-sparse.sh
index 5f12bad..1a6da86 100755
--- a/copy/copy-sparse.sh
+++ b/copy/copy-sparse.sh
@@ -50,7 +50,7 @@ $VG nbdcopy -S 0 -- \
# Order of the output could vary because requests are sent in
# parallel.
-LC_ALL=C sort -n -o $out $out
+LC_ALL=C sort -k1,1 -k2,2n -k3,3n -o $out $out
echo Output:
cat $out
@@ -61,11 +61,16 @@ pwrite 32768 0
pwrite 32768 1073709056
pwrite 32768 4294934528
zero 134184960 32768 may_trim
-zero 134184960 4160749568 may_trim
zero 134184960 939524096 may_trim
+zero 134184960 4160749568 may_trim
+zero 134217728 134217728 may_trim
+zero 134217728 268435456 may_trim
+zero 134217728 402653184 may_trim
+zero 134217728 536870912 may_trim
+zero 134217728 671088640 may_trim
+zero 134217728 805306368 may_trim
zero 134217728 1073741824 may_trim
zero 134217728 1207959552 may_trim
-zero 134217728 134217728 may_trim
zero 134217728 1342177280 may_trim
zero 134217728 1476395008 may_trim
zero 134217728 1610612736 may_trim
@@ -76,7 +81,6 @@ zero 134217728 2147483648 may_trim
zero 134217728 2281701376 may_trim
zero 134217728 2415919104 may_trim
zero 134217728 2550136832 may_trim
-zero 134217728 268435456 may_trim
zero 134217728 2684354560 may_trim
zero 134217728 2818572288 may_trim
zero 134217728 2952790016 may_trim
@@ -87,11 +91,7 @@ zero 134217728 3489660928 may_trim
zero 134217728 3623878656 may_trim
zero 134217728 3758096384 may_trim
zero 134217728 3892314112 may_trim
-zero 134217728 402653184 may_trim
-zero 134217728 4026531840 may_trim
-zero 134217728 536870912 may_trim
-zero 134217728 671088640 may_trim
-zero 134217728 805306368 may_trim" ]; then
+zero 134217728 4026531840 may_trim" ]; then
echo "$0: output does not match expected"
exit 1
fi
--
2.29.0.rc2

View File

@ -1,71 +0,0 @@
From 4e456ff6363580177ceffdad79b8fc1e8c7f35eb Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 3 Mar 2021 10:12:31 +0000
Subject: [PATCH 3/6] Revert "copy: file-ops.c: Remove unneeded check"
This reverts commit 0f6e4f38bc440fc52c20a3a448ef031f806ec5e2.
This fails on ppc64le only with:
lt-nbdcopy: file-ops.c:136: page_was_cached: Assertion `page < rwf->cached_pages.size' failed.
Coincidentally this is the only architecture on Fedora that uses a 64K
page size, although I don't know if that is connected. I was not able
to make this fail on x86.
---
copy/file-ops.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/copy/file-ops.c b/copy/file-ops.c
index 47ec768..ea725a4 100644
--- a/copy/file-ops.c
+++ b/copy/file-ops.c
@@ -102,7 +102,7 @@ page_size_init (void)
/* Load the page cache map for a particular file into
* rwf->cached_pages. Only used when reading files. This doesn't
* fail: if a system call fails then rwf->cached_pages.size will be
- * zero which is handled in page_cache_evict.
+ * zero which is handled in page_was_cached.
*/
static inline void
page_cache_map (struct rw_file *rwf)
@@ -126,16 +126,19 @@ page_cache_map (struct rw_file *rwf)
munmap (ptr, rwf->rw.size);
}
-/* Test if a single page of the file was cached before nbdcopy ran.
- * Valid only if we mapped the cached pages.
- */
+/* Test if a single page of the file was cached before nbdcopy ran. */
static inline bool
page_was_cached (struct rw_file *rwf, uint64_t offset)
{
uint64_t page = offset / page_size;
- assert (page < rwf->cached_pages.size);
-
- return (rwf->cached_pages.ptr[page] & 1) != 0;
+ if (page < rwf->cached_pages.size)
+ return (rwf->cached_pages.ptr[page] & 1) != 0;
+ else
+ /* This path is taken if we didn't manage to map the input file
+ * for any reason. In this case assume that pages were mapped so
+ * we will not evict them: essentially fall back to doing nothing.
+ */
+ return true;
}
/* Evict file contents from the page cache if they were not present in
@@ -147,10 +150,6 @@ page_cache_evict (struct rw_file *rwf, uint64_t orig_offset, size_t orig_len)
uint64_t offset, n;
size_t len;
- /* If we didn't manage to map the input file for any reason, assume
- * that pages were mapped so we will not evict them: essentially fall
- * back to doing nothing.
- */
if (rwf->cached_pages.size == 0) return;
/* Only bother with whole pages. */
--
2.29.0.rc2

View File

@ -1,67 +0,0 @@
From 94a78764d80b6dc41ff2ae8a0e5f1b35c2fd8e78 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Sat, 27 Feb 2021 05:36:38 +0200
Subject: [PATCH 4/6] copy: file-ops.c: Remove unneeded check
This function is called only from page_cache_evict(), which already
check that we could map the cached pages. Add an assert to document this
assumption.
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
---
copy/file-ops.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/copy/file-ops.c b/copy/file-ops.c
index ea725a4..47ec768 100644
--- a/copy/file-ops.c
+++ b/copy/file-ops.c
@@ -102,7 +102,7 @@ page_size_init (void)
/* Load the page cache map for a particular file into
* rwf->cached_pages. Only used when reading files. This doesn't
* fail: if a system call fails then rwf->cached_pages.size will be
- * zero which is handled in page_was_cached.
+ * zero which is handled in page_cache_evict.
*/
static inline void
page_cache_map (struct rw_file *rwf)
@@ -126,19 +126,16 @@ page_cache_map (struct rw_file *rwf)
munmap (ptr, rwf->rw.size);
}
-/* Test if a single page of the file was cached before nbdcopy ran. */
+/* Test if a single page of the file was cached before nbdcopy ran.
+ * Valid only if we mapped the cached pages.
+ */
static inline bool
page_was_cached (struct rw_file *rwf, uint64_t offset)
{
uint64_t page = offset / page_size;
- if (page < rwf->cached_pages.size)
- return (rwf->cached_pages.ptr[page] & 1) != 0;
- else
- /* This path is taken if we didn't manage to map the input file
- * for any reason. In this case assume that pages were mapped so
- * we will not evict them: essentially fall back to doing nothing.
- */
- return true;
+ assert (page < rwf->cached_pages.size);
+
+ return (rwf->cached_pages.ptr[page] & 1) != 0;
}
/* Evict file contents from the page cache if they were not present in
@@ -150,6 +147,10 @@ page_cache_evict (struct rw_file *rwf, uint64_t orig_offset, size_t orig_len)
uint64_t offset, n;
size_t len;
+ /* If we didn't manage to map the input file for any reason, assume
+ * that pages were mapped so we will not evict them: essentially fall
+ * back to doing nothing.
+ */
if (rwf->cached_pages.size == 0) return;
/* Only bother with whole pages. */
--
2.29.0.rc2

View File

@ -1,32 +0,0 @@
From 107eb605cfb75238020332b5a5461d0e09d62bec Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 3 Mar 2021 12:51:51 +0100
Subject: [PATCH 5/6] copy/file-ops.c: Fix page eviction when len < page_size.
On Fedora ppc64le at the moment page size is 64K. When asked to evict
a range with length < 64K the length calculation wrapped around and it
tried to evict a huge number of pages beyond the end of the file.
With Nir's commit 0f6e4f38b this (correctly) resulted in an assertion
failure.
Fix this by checking for the overflow and returning early.
---
copy/file-ops.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/copy/file-ops.c b/copy/file-ops.c
index 47ec768..6bad50c 100644
--- a/copy/file-ops.c
+++ b/copy/file-ops.c
@@ -155,6 +155,7 @@ page_cache_evict (struct rw_file *rwf, uint64_t orig_offset, size_t orig_len)
/* Only bother with whole pages. */
offset = ROUND_UP (orig_offset, page_size);
+ if (orig_len < offset - orig_offset) return;
len = orig_len - (offset - orig_offset);
len = ROUND_DOWN (len, page_size);
--
2.29.0.rc2

View File

@ -1,119 +0,0 @@
From 64962a582c00828cc2d26d94b149840ab2402165 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake@redhat.com>
Date: Thu, 4 Mar 2021 09:27:56 -0600
Subject: [PATCH 6/6] info: Let exit status reflect any failures during
NBD_OPT_INFO
It turns out that at least nbdkit's testsuite was relying on a
non-zero exit status from nbdinfo when purposefully attempting to get
info on an invalid export name. Printing as much information as
possible instead of going silent becaus of one error is good, but any
time we print to stderr, the exit status should reflect that.
Fixes: 5473e34fc1 (info: Don't kill --list early just because one opt_info fails)
Reported-by: Rich Jones <rjones@redhat.com>
---
info/nbdinfo.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/info/nbdinfo.c b/info/nbdinfo.c
index 4b18ab2..3dfc463 100644
--- a/info/nbdinfo.c
+++ b/info/nbdinfo.c
@@ -58,9 +58,9 @@ DEFINE_VECTOR_TYPE (uint32_vector, uint32_t)
static int collect_context (void *opaque, const char *name);
static int collect_export (void *opaque, const char *name,
const char *desc);
-static void list_one_export (struct nbd_handle *nbd, const char *desc,
+static bool list_one_export (struct nbd_handle *nbd, const char *desc,
bool first, bool last);
-static void list_all_exports (struct nbd_handle *nbd1, const char *uri);
+static bool list_all_exports (struct nbd_handle *nbd1, const char *uri);
static void print_json_string (const char *);
static char *get_content (struct nbd_handle *, int64_t size);
static int extent_callback (void *user_data, const char *metacontext,
@@ -124,6 +124,7 @@ main (int argc, char *argv[])
int tls_negotiated;
char *output = NULL;
size_t output_len = 0;
+ bool list_okay = true;
progname = argv[0];
@@ -336,9 +337,9 @@ main (int argc, char *argv[])
}
if (!list_all)
- list_one_export (nbd, NULL, true, true);
+ list_okay = list_one_export (nbd, NULL, true, true);
else
- list_all_exports (nbd, argv[optind]);
+ list_okay = list_all_exports (nbd, argv[optind]);
if (json_output)
fprintf (fp, "}\n");
@@ -365,7 +366,7 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
- exit (EXIT_SUCCESS);
+ exit (list_okay ? EXIT_SUCCESS : EXIT_FAILURE);
}
static int
@@ -398,7 +399,7 @@ collect_export (void *opaque, const char *name, const char *desc)
return 0;
}
-static void
+static bool
list_one_export (struct nbd_handle *nbd, const char *desc,
bool first, bool last)
{
@@ -424,7 +425,7 @@ list_one_export (struct nbd_handle *nbd, const char *desc,
nbd_opt_go (nbd) == -1) {
fprintf (stderr, "%s: %s: %s\n", progname, nbd_get_export_name (nbd),
nbd_get_error ());
- return;
+ return false;
}
size = nbd_get_size (nbd);
if (size == -1) {
@@ -599,12 +600,14 @@ list_one_export (struct nbd_handle *nbd, const char *desc,
free (content);
free (export_name);
free (export_desc);
+ return true;
}
-static void
+static bool
list_all_exports (struct nbd_handle *nbd1, const char *uri)
{
size_t i;
+ bool list_okay = true;
if (export_list.size == 0 && json_output)
fprintf (fp, "\"exports\": []\n");
@@ -639,14 +642,16 @@ list_all_exports (struct nbd_handle *nbd1, const char *uri)
}
/* List the metadata of this export. */
- list_one_export (nbd2, export_list.ptr[i].desc, i == 0,
- i + 1 == export_list.size);
+ if (!list_one_export (nbd2, export_list.ptr[i].desc, i == 0,
+ i + 1 == export_list.size))
+ list_okay = false;
if (probe_content) {
nbd_shutdown (nbd2, 0);
nbd_close (nbd2);
}
}
+ return list_okay;
}
static void
--
2.29.0.rc2

View File

@ -1,6 +1,6 @@
--- !Policy
product_versions:
- rhel-8
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -8,7 +8,7 @@
%global source_directory 1.7-development
Name: libnbd
Version: 1.7.9
Version: 1.7.12
Release: 1%{?dist}
Summary: NBD client library in userspace
@ -317,6 +317,15 @@ make %{?_smp_mflags} check || {
%changelog
* Sat May 29 2021 Richard W.M. Jones <rjones@redhat.com> - 1.7.12-1
- New upstream version 1.7.12.
* Thu May 20 2021 Richard W.M. Jones <rjones@redhat.com> - 1.7.11-1
- New upstream version 1.7.11.
* Fri May 14 2021 Richard W.M. Jones <rjones@redhat.com> - 1.7.10-1
- New upstream version 1.7.10.
* Thu Apr 29 2021 Richard W.M. Jones <rjones@redhat.com> - 1.7.9-1
- New upstream version 1.7.9.
- Switch to fuse3.

View File

@ -1,2 +1,2 @@
SHA512 (libnbd-1.7.9.tar.gz) = 6fe3db6f5027fee59e60e7ea688111787567a4ac740db34ebdc45bccc76e34cc6298784c8b628cb40ff639caceca5d5413558187892511d9ac2167fc60b3d92a
SHA512 (libnbd-1.7.9.tar.gz.sig) = f2ee29fe7017cec4a3ec0c03119b2c1d5de735f6703a12e4ecddcddf8548bf7e1be62440f54c9fd3859fb63072f1ef8fb6ef56c2db462f624f0efef254052970
SHA512 (libnbd-1.7.12.tar.gz) = 62ec0600d42ae5fb8b779cf0c885fa9ff708472c67cb21f9ca964c986f82c6072087e59efc86547037543e01ba7348a0d1771fb1aa76a4f8905ebfe7af5bb4c1
SHA512 (libnbd-1.7.12.tar.gz.sig) = ffc116fa642e8b8db74ca7eb51d8e2ec4fc68903d69c61eb9067fb3e976cb4c4c7b1019dd1e794fe34d4077032a3f6022469d72951876b08a1026f880f366bf7