Rebase to new stable branch version 1.10.2
resolves: rhbz#2011708 Also updates keyring to latest from https://download.libguestfs.org/
This commit is contained in:
parent
f05317d624
commit
3dc6b0232f
@ -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
|
||||
|
@ -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
|
||||
|
Binary file not shown.
@ -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
|
||||
|
4
sources
4
sources
@ -1,2 +1,2 @@
|
||||
SHA512 (libnbd-1.10.1.tar.gz) = 9deb537535093ec52a73763b5c05f591d4f9e88a2910c375411316b8c2a7861f8f845f6071b8d426467bbb1843b2c1b7131206d344d3fd9904e8a02dcd97a9e8
|
||||
SHA512 (libnbd-1.10.1.tar.gz.sig) = 94e1c9cbfc4c611d26498fd8df4a574bfefb5a706b2a8831b955b8b4b1a3d460b3ca26f5747015fccef5a5a36940535cc4d4a1f8d45aa1080dab52ba289a981b
|
||||
SHA512 (libnbd-1.10.2.tar.gz) = 531be74fe35bead20e051cfc96ea6867261b10251ef249651326a3af691fa69c843c7f47a7244996807d353c5574ad3c418704280f45acbd6a8fb8c84b74dbbf
|
||||
SHA512 (libnbd-1.10.2.tar.gz.sig) = ef32a2b0a493ddd20d8ad57e8330ee208fd653a2416b2d0c87aff9077d5b6045e7ec74cfa9aebd900dc9fc928c8c2866031a999357c76d0d2fe6b6352f50abfd
|
||||
|
Loading…
Reference in New Issue
Block a user