Update patch to work with qemu from Rawhide.

This commit is contained in:
Richard W.M. Jones 2011-08-02 13:43:46 +01:00
parent 41318d8b25
commit 5f60f6f080
3 changed files with 4 additions and 83 deletions

View File

@ -1,79 +0,0 @@
From 2b8b3f9794ceb43eabd3083e225c669896d8b186 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 26 Jul 2011 18:57:19 +0100
Subject: [PATCH] ocaml: Fix locking in event callbacks.
We weren't acquiring the GC lock around some allocations, resulting in
segfaults when an event callback ran at the same time as a main thread
allocation or garbage collection.
In particular this fixes a noticable crash in guestfs-browser.
---
ocaml/guestfs_c.c | 36 +++++++++++++++++++++++++++---------
1 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/ocaml/guestfs_c.c b/ocaml/guestfs_c.c
index 3f862ea..96e8a35 100644
--- a/ocaml/guestfs_c.c
+++ b/ocaml/guestfs_c.c
@@ -327,13 +327,13 @@ event_bitmask_to_event (uint64_t event)
}
static void
-event_callback_wrapper (guestfs_h *g,
- void *data,
- uint64_t event,
- int event_handle,
- int flags,
- const char *buf, size_t buf_len,
- const uint64_t *array, size_t array_len)
+event_callback_wrapper_locked (guestfs_h *g,
+ void *data,
+ uint64_t event,
+ int event_handle,
+ int flags,
+ const char *buf, size_t buf_len,
+ const uint64_t *array, size_t array_len)
{
CAMLparam0 ();
CAMLlocal5 (gv, evv, ehv, bufv, arrayv);
@@ -360,9 +360,7 @@ event_callback_wrapper (guestfs_h *g,
value args[5] = { gv, evv, ehv, bufv, arrayv };
- caml_leave_blocking_section ();
rv = caml_callbackN_exn (*(value*)data, 5, args);
- caml_enter_blocking_section ();
/* Callbacks shouldn't throw exceptions. There's not much we can do
* except to print it.
@@ -375,6 +373,26 @@ event_callback_wrapper (guestfs_h *g,
CAMLreturn0;
}
+static void
+event_callback_wrapper (guestfs_h *g,
+ void *data,
+ uint64_t event,
+ int event_handle,
+ int flags,
+ const char *buf, size_t buf_len,
+ const uint64_t *array, size_t array_len)
+{
+ /* Ensure we are holding the GC lock before any GC operations are
+ * possible. (RHBZ#725824)
+ */
+ caml_leave_blocking_section ();
+
+ event_callback_wrapper_locked (g, data, event, event_handle, flags,
+ buf, buf_len, array, array_len);
+
+ caml_enter_blocking_section ();
+}
+
value
ocaml_guestfs_last_errno (value gv)
{
--
1.7.5.2

View File

@ -7,7 +7,7 @@ diff -ur libguestfs-1.12.0.old/configure libguestfs-1.12.0/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for virtio-serial support in $QEMU" >&5
$as_echo_n "checking for virtio-serial support in $QEMU... " >&6; }
- if $QEMU -nographic -device \? 2>&1 | grep -sq virtio-serial; then
+ if $QEMU -machine accel=tcg -nographic -device \? 2>&1 | grep -sq virtio-serial; then
+ if $QEMU -machine pc,accel=tcg -nographic -device \? 2>&1 | grep -sq virtio-serial; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
@ -19,7 +19,7 @@ diff -ur libguestfs-1.12.0.old/configure.ac libguestfs-1.12.0/configure.ac
AC_MSG_CHECKING([for virtio-serial support in $QEMU])
- if $QEMU -nographic -device \? 2>&1 | grep -sq virtio-serial; then
+ if $QEMU -machine accel=tcg -nographic -device \? 2>&1 | grep -sq virtio-serial; then
+ if $QEMU -machine pc,accel=tcg -nographic -device \? 2>&1 | grep -sq virtio-serial; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])

View File

@ -30,7 +30,7 @@ Summary: Access and modify virtual machine disk images
Name: libguestfs
Epoch: 1
Version: 1.13.2
Release: 2%{?dist}
Release: 3%{?dist}
License: LGPLv2+
Group: Development/Libraries
URL: http://libguestfs.org/
@ -871,7 +871,7 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Aug 2 2011 Richard W.M. Jones <rjones@redhat.com> - 1:1.13.2-2
* Tue Aug 2 2011 Richard W.M. Jones <rjones@redhat.com> - 1:1.13.2-3
- Switch Rawhide to use the new development branch (1.13).
- New upstream version 1.13.2.
- Remove upstream patch.