New upstream development version 1.19.3
This commit is contained in:
parent
1fb6c2eeb1
commit
67fcbe599b
@ -1,106 +0,0 @@
|
|||||||
From db48794fa89547a4799b832331e82b4b8b98f03d Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
||||||
Date: Wed, 13 Dec 2023 22:32:12 +0000
|
|
||||||
Subject: [PATCH 1/2] ocaml: Use Gc.finalize instead of a C finalizer
|
|
||||||
|
|
||||||
Since OCaml 5.1.1, C finalizers no longer allow calling
|
|
||||||
caml_enter_blocking_section. They are relatively inflexible compared
|
|
||||||
to registering an OCaml finalizer (Gc.finalize) to call NBD.close, so
|
|
||||||
use that instead.
|
|
||||||
|
|
||||||
I didn't replace NBD.Buffer which still uses a C finalizer. This one
|
|
||||||
doesn't call caml_enter_blocking_section.
|
|
||||||
|
|
||||||
Suggested-by: Guillaume Munch-Maccagnoni
|
|
||||||
See: https://github.com/ocaml/ocaml/issues/12820
|
|
||||||
---
|
|
||||||
generator/OCaml.ml | 7 ++++++-
|
|
||||||
ocaml/handle.c | 21 ++++++++-------------
|
|
||||||
ocaml/nbd-c.h | 3 +--
|
|
||||||
3 files changed, 15 insertions(+), 16 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/generator/OCaml.ml b/generator/OCaml.ml
|
|
||||||
index 095a31df27..4d8501b518 100644
|
|
||||||
--- a/generator/OCaml.ml
|
|
||||||
+++ b/generator/OCaml.ml
|
|
||||||
@@ -343,9 +343,14 @@ let
|
|
||||||
|
|
||||||
type t
|
|
||||||
|
|
||||||
-external create : unit -> t = \"nbd_internal_ocaml_nbd_create\"
|
|
||||||
+external _create : unit -> t = \"nbd_internal_ocaml_nbd_create\"
|
|
||||||
external close : t -> unit = \"nbd_internal_ocaml_nbd_close\"
|
|
||||||
|
|
||||||
+let create () =
|
|
||||||
+ let nbd = _create () in
|
|
||||||
+ Gc.finalise close nbd;
|
|
||||||
+ nbd
|
|
||||||
+
|
|
||||||
let with_handle f =
|
|
||||||
let nbd = create () in
|
|
||||||
try let r = f nbd in close nbd; r with exn -> close nbd; raise exn
|
|
||||||
diff --git a/ocaml/handle.c b/ocaml/handle.c
|
|
||||||
index b3e5a0fc33..0e809c6f0d 100644
|
|
||||||
--- a/ocaml/handle.c
|
|
||||||
+++ b/ocaml/handle.c
|
|
||||||
@@ -32,16 +32,6 @@
|
|
||||||
|
|
||||||
#include "nbd-c.h"
|
|
||||||
|
|
||||||
-void
|
|
||||||
-nbd_internal_ocaml_handle_finalize (value hv)
|
|
||||||
-{
|
|
||||||
- struct nbd_handle *h = NBD_val (hv);
|
|
||||||
-
|
|
||||||
- caml_enter_blocking_section ();
|
|
||||||
- nbd_close (h);
|
|
||||||
- caml_leave_blocking_section ();
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
value
|
|
||||||
nbd_internal_ocaml_nbd_create (value unitv)
|
|
||||||
{
|
|
||||||
@@ -61,11 +51,16 @@ value
|
|
||||||
nbd_internal_ocaml_nbd_close (value hv)
|
|
||||||
{
|
|
||||||
CAMLparam1 (hv);
|
|
||||||
+ struct nbd_handle *h = NBD_val (hv);
|
|
||||||
|
|
||||||
- nbd_internal_ocaml_handle_finalize (hv);
|
|
||||||
+ if (h) {
|
|
||||||
+ caml_enter_blocking_section ();
|
|
||||||
+ nbd_close (h);
|
|
||||||
+ caml_leave_blocking_section ();
|
|
||||||
|
|
||||||
- /* So we don't double-free in the finalizer. */
|
|
||||||
- NBD_val (hv) = NULL;
|
|
||||||
+ /* So we don't double-free. */
|
|
||||||
+ NBD_val (hv) = NULL;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
CAMLreturn (Val_unit);
|
|
||||||
}
|
|
||||||
diff --git a/ocaml/nbd-c.h b/ocaml/nbd-c.h
|
|
||||||
index adcdd15aa8..134c3a1608 100644
|
|
||||||
--- a/ocaml/nbd-c.h
|
|
||||||
+++ b/ocaml/nbd-c.h
|
|
||||||
@@ -54,7 +54,6 @@ caml_alloc_initialized_string (mlsize_t len, const char *p)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-extern void nbd_internal_ocaml_handle_finalize (value);
|
|
||||||
extern void nbd_internal_ocaml_buffer_finalize (value);
|
|
||||||
|
|
||||||
extern void nbd_internal_ocaml_raise_error (void) Noreturn;
|
|
||||||
@@ -72,7 +71,7 @@ extern void nbd_internal_ocaml_exception_in_wrapper (const char *, value);
|
|
||||||
|
|
||||||
static struct custom_operations libnbd_custom_operations = {
|
|
||||||
"libnbd_custom_operations",
|
|
||||||
- nbd_internal_ocaml_handle_finalize,
|
|
||||||
+ custom_finalize_default,
|
|
||||||
custom_compare_default,
|
|
||||||
custom_hash_default,
|
|
||||||
custom_serialize_default,
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
From 37997f7e9a694715c764528567e569812fa3066a Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
||||||
Date: Thu, 14 Dec 2023 08:34:56 +0000
|
|
||||||
Subject: [PATCH 2/2] ocaml: Nullify custom block before releasing runtime lock
|
|
||||||
|
|
||||||
Avoids a potential, though if possible then very rare, double free
|
|
||||||
path.
|
|
||||||
|
|
||||||
Suggested-by: Guillaume Munch-Maccagnoni
|
|
||||||
See: https://github.com/ocaml/ocaml/issues/12820
|
|
||||||
---
|
|
||||||
ocaml/handle.c | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/ocaml/handle.c b/ocaml/handle.c
|
|
||||||
index 0e809c6f0d..8d8a632fef 100644
|
|
||||||
--- a/ocaml/handle.c
|
|
||||||
+++ b/ocaml/handle.c
|
|
||||||
@@ -54,12 +54,12 @@ nbd_internal_ocaml_nbd_close (value hv)
|
|
||||||
struct nbd_handle *h = NBD_val (hv);
|
|
||||||
|
|
||||||
if (h) {
|
|
||||||
+ /* So we don't double-free. */
|
|
||||||
+ NBD_val (hv) = NULL;
|
|
||||||
+
|
|
||||||
caml_enter_blocking_section ();
|
|
||||||
nbd_close (h);
|
|
||||||
caml_leave_blocking_section ();
|
|
||||||
-
|
|
||||||
- /* So we don't double-free. */
|
|
||||||
- NBD_val (hv) = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
CAMLreturn (Val_unit);
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
11
libnbd.spec
11
libnbd.spec
@ -8,8 +8,8 @@
|
|||||||
%global source_directory 1.19-development
|
%global source_directory 1.19-development
|
||||||
|
|
||||||
Name: libnbd
|
Name: libnbd
|
||||||
Version: 1.19.2
|
Version: 1.19.3
|
||||||
Release: 4%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: NBD client library in userspace
|
Summary: NBD client library in userspace
|
||||||
|
|
||||||
License: LGPL-2.0-or-later AND BSD-3-Clause
|
License: LGPL-2.0-or-later AND BSD-3-Clause
|
||||||
@ -25,10 +25,6 @@ Source2: libguestfs.keyring
|
|||||||
# Maintainer script which helps with handling patches.
|
# Maintainer script which helps with handling patches.
|
||||||
Source3: copy-patches.sh
|
Source3: copy-patches.sh
|
||||||
|
|
||||||
# Fixes for https://github.com/ocaml/ocaml/issues/12820
|
|
||||||
Patch: 0001-ocaml-Use-Gc.finalize-instead-of-a-C-finalizer.patch
|
|
||||||
Patch: 0002-ocaml-Nullify-custom-block-before-releasing-runtime-.patch
|
|
||||||
|
|
||||||
%if 0%{patches_touch_autotools}
|
%if 0%{patches_touch_autotools}
|
||||||
BuildRequires: autoconf, automake, libtool
|
BuildRequires: autoconf, automake, libtool
|
||||||
%endif
|
%endif
|
||||||
@ -379,6 +375,9 @@ make %{?_smp_mflags} check || {
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 19 2023 Richard W.M. Jones <rjones@redhat.com> - 1.19.3-1
|
||||||
|
- New upstream development version 1.19.3
|
||||||
|
|
||||||
* Mon Dec 18 2023 Richard W.M. Jones <rjones@redhat.com> - 1.19.2-4
|
* Mon Dec 18 2023 Richard W.M. Jones <rjones@redhat.com> - 1.19.2-4
|
||||||
- OCaml 5.1.1 + s390x code gen fix for Fedora 40
|
- OCaml 5.1.1 + s390x code gen fix for Fedora 40
|
||||||
|
|
||||||
|
4
sources
4
sources
@ -1,2 +1,2 @@
|
|||||||
SHA512 (libnbd-1.19.2.tar.gz) = 6e0b6f85bd4465d1f94f66eafc4d9dfbf686b38ee314f7faddcdea8a45a98e6eb00ffd0f1ed392a40798508b67edbff6ebe1c31f45011e5d7e5814d095c06005
|
SHA512 (libnbd-1.19.3.tar.gz) = ace3736f0dd26ab95bcf6db6d3fad7f094a85a01a1a947be1166c81dc83719129078dc380007e1abe527f7333aa7f05730ed4fd5a71dbf1da899094bbab970a8
|
||||||
SHA512 (libnbd-1.19.2.tar.gz.sig) = 33e787ef17089ea468eacdeb21c8562c49180e1e4af842db0012a9b10eb02f7ebe5edbdf7e86da917beada7d71b6f8ad592d3f2692e88da86447111c083abf25
|
SHA512 (libnbd-1.19.3.tar.gz.sig) = 4fa1c2b125c98632562ea952104f133573961567ac289a748f31bd1dc0d33cfc7e6280c6ea47478f365a58afef83098bb68abf8fa825cfcf99f1393da60c0058
|
||||||
|
Loading…
Reference in New Issue
Block a user