import libnbd-1.10.2-1.el9

This commit is contained in:
CentOS Sources 2022-01-11 13:05:36 -05:00 committed by Stepan Oksanichenko
parent 6a0cf22960
commit 626ce40bcf
7 changed files with 18 additions and 150 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/libguestfs.keyring
SOURCES/libnbd-1.10.1.tar.gz
SOURCES/libnbd-1.10.2.tar.gz

View File

@ -1,2 +1,2 @@
1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring
93c2960d4c8907092c38478239ab67b16dc28ad4 SOURCES/libnbd-1.10.1.tar.gz
cc1b37b9cfafa515aab3eefd345ecc59aac2ce7b SOURCES/libguestfs.keyring
afc97351958c6ff7d5417240e9a7e01433cc7446 SOURCES/libnbd-1.10.2.tar.gz

View File

@ -1,70 +0,0 @@
From 0dc8ee268e56fb8b8dcd18fd3483045e65ffc5a2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 26 Oct 2021 13:40:16 +0100
Subject: [PATCH] python: Fix crash when passing None as a buffer
$ nbdkit -U - null 512 --run 'nbdsh -u $uri -c "h.pwrite(None, 0)"'
nbdkit: external command was killed by signal 11
The stack trace indicated that the code was calling
PyBuffer_Release (&buf) on an uninitialized buffer 'buf'. What was
happening was that PyArg_ParseTuple was recognizing the type error in
the parameter (None is not a buffer-like object) and failing, but it
didn't initialize the Py_buffer parameter so that contained random
stuff from the stack, and then we tried to release it by calling
PyBuffer_Release.
To fix this, initialize the stack buffer, then avoid calling
PyBuffer_Release if the .obj field in the Py_buffer is still NULL
(which should be impossible if PyArg_ParseTuple set the &buf
parameter).
After this commit we see the type error:
$ nbdkit -U - null 512 --run './run nbdsh -u $uri -c "h.pwrite(None, 0)"'
Traceback (most recent call last):
File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/rjones/d/libnbd/python/nbd.py", line 2568, in <module>
nbdsh.shell()
File "/home/rjones/d/libnbd/python/nbdsh.py", line 138, in shell
exec(c, d, d)
File "<string>", line 1, in <module>
File "/home/rjones/d/libnbd/python/nbd.py", line 1610, in pwrite
return libnbdmod.pwrite(self._o, buf, offset, flags)
TypeError: a bytes-like object is required, not 'NoneType'
(cherry picked from commit 51195424f8ba73d0ab1fb4145ddfa81cb8056d4e)
---
generator/Python.ml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/generator/Python.ml b/generator/Python.ml
index cd12f27..49281bf 100644
--- a/generator/Python.ml
+++ b/generator/Python.ml
@@ -274,7 +274,7 @@ let print_python_binding name { args; optargs; ret; may_set_error } =
function
| Bool n -> pr " int %s;\n" n
| BytesIn (n, _) ->
- pr " Py_buffer %s;\n" n
+ pr " Py_buffer %s = { .obj = NULL };\n" n
| BytesOut (n, count) ->
pr " char *%s = NULL;\n" n;
pr " Py_ssize_t %s;\n" count
@@ -552,7 +552,9 @@ let print_python_binding name { args; optargs; ret; may_set_error } =
List.iter (
function
| Bool _ -> ()
- | BytesIn (n, _) -> pr " PyBuffer_Release (&%s);\n" n
+ | BytesIn (n, _) ->
+ pr " if (%s.obj)\n" n;
+ pr " PyBuffer_Release (&%s);\n" n
| BytesOut (n, _) -> pr " free (%s);\n" n
| BytesPersistIn _ | BytesPersistOut _ -> ()
| Closure { cbname } ->
--
2.31.1

View File

@ -1,55 +0,0 @@
From 48136328150bc587178091b5766bda382158cb6c Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Sat, 23 Oct 2021 00:08:31 +0300
Subject: [PATCH] lib/poll.c: Retry poll after EINTR
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
I see a rare random failure when calling BlockStatus via Go binding:
block_status: nbd_block_status: poll: Interrupted system call
I could not reproduce this with "nbdinfo --map", even after modifying it
to call nbd_block_status() for every 128 MiB.
Fixing this in nbd_unlock_poll() avoids this issue in the entire
library, when we wait for command completion. This seems more useful
that fixing it in all libnbd clients.
Tested using a go client listing all extents in an image, calling
BlockStatus for every 128m with fedora 34 qcow2 image. Without this fix,
this was always failing.
$ hyperfine -r1000 --show-output "./client nbd+unix://?socket=/tmp/nbd.sock > /dev/null"
Benchmark 1: ./client nbd+unix://?socket=/tmp/nbd.sock > /dev/null
Time (mean ± σ): 31.6 ms ± 3.1 ms [User: 8.8 ms, System: 7.2 ms]
Range (min … max): 26.1 ms … 52.3 ms 1000 runs
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
(cherry picked from commit b3440853cdeca0e44ad9c526e71faaa6cf344bfc)
---
lib/poll.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/poll.c b/lib/poll.c
index edfcc59..df01d94 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -57,8 +57,11 @@ nbd_unlocked_poll (struct nbd_handle *h, int timeout)
* would allow other threads to close file descriptors which we have
* passed to poll.
*/
- r = poll (fds, 1, timeout);
- debug (h, "poll end: r=%d revents=%x", r, fds[0].revents);
+ do {
+ r = poll (fds, 1, timeout);
+ debug (h, "poll end: r=%d revents=%x", r, fds[0].revents);
+ } while (r == -1 && errno == EINTR);
+
if (r == -1) {
set_error (errno, "poll");
return -1;
--
2.31.1

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmF3FQsRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKCfDxAAr9J71xypiwy+Vk6n+WFk0bwcMSIxVsQP
dDSUVOeZsW6WLO8nENYNFiFEkcYiFCK8n9QDrqiY6u6EpyLd6WGgzzVpL2FzZT+n
yNq/N9sK3BrWR8b4aGJzGhkdmFtlnX/qLo80hDG9tb9rg1m13z64ZME7vw7mNJxx
wnWXx34uuQEXIwU7QdMFqriHUuyw5o+4unqhSKosupJVFmVHW6HuF0sJS8s5f5h9
2cmWAsK/fi0ghUA3u5Ghqn8bO0BYjiOAVV2n+1SBaxAw6gf3potNoCql5CxA8tOz
59ag4m8enU1wn0yQlMLAcpxm2gWoSAWI2Fr2FfRCa3cnDkjf3+UuaNb+Guu8b2D5
Leym0vNBtzIVy8Le8wtffEMYKZ4Tqi1DFs4zvzGCOGymOh7t+DJR55rfqz9FLIwX
YoZSJOF2SBKVe5LkGeSZ99akURaR7J5Ac58ydDo0ju3c3IOICqMmO32QKozRCd5D
z1QNDDMM0tizR5V9PFn+i5UCUWhRUn85pOaycIMHtk7hEwXYh4LeAg8RvnBambdH
+IAFs3kvzltksQpFdT2pPumbphK0IpmCg2jafibErRhhDjJXu5yNb6Bmq/cPBvNb
FTH5n+xc2RzcIleCOhnU6A2so94jcAbbxAtkvNYc7BnyjuQQiVWbvh8tea39SeLp
otypH/UCi+0=
=/4VT
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----
iQEzBAABCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAmGmmukACgkQp6FrSiUn
Q2o9iQf/QD7+wZgj95H8zpSlavOrxJv+9feGoi60GR9nxT4BauJN7QI6Z3KwbIZr
002chHjz5HO7096+a9D1cptAhh6NZnFDWEjGH0bkjKQxr/tw1ajAhRjQMWwDibhZ
7XWoiqMfMEnJVwhZMHBpN2ph9nLywl6aJn3SRwnUfS2nSeYjyBhWoSv0xnIqhW4M
sPxFZrnJWQnhBluHIoi/mbJiPF+vE/L04wCbitpSppgdHg2nBYo9RWdRP+Sgb6Jq
g17tBCuTkchqo4QWyP9JKfN5GBb39IyoajazSN8PO4bMeCbltZzsN0z7W7GzvKaw
WjIFoeDAC7p1J1jW645OnESTHR42lw==
=msmP
-----END PGP SIGNATURE-----

View File

@ -8,7 +8,7 @@
%global source_directory 1.10-stable
Name: libnbd
Version: 1.10.1
Version: 1.10.2
Release: 1%{?dist}
Summary: NBD client library in userspace
@ -29,8 +29,7 @@ Source3: copy-patches.sh
# https://gitlab.com/nbdkit/libnbd/-/commits/rhel-9.0/
# Patches.
Patch0001: 0001-python-Fix-crash-when-passing-None-as-a-buffer.patch
Patch0002: 0002-lib-poll.c-Retry-poll-after-EINTR.patch
#(nothing)
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
@ -324,8 +323,8 @@ make %{?_smp_mflags} check || {
%changelog
* Sat Oct 30 2021 Richard W.M. Jones <rjones@redhat.com> - 1.10.1-1
- Rebase to new stable branch version 1.10.1
* Thu Dec 02 2021 Richard W.M. Jones <rjones@redhat.com> - 1.10.2-1
- Rebase to new stable branch version 1.10.2
resolves: rhbz#2011708
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.8.2-3