rpms/gtk-vnc/devel gtk-vnc-0.2.0-coroutine-caller.patch, NONE, 1.1 gtk-vnc.spec, 1.5, 1.6

Daniel P. Berrange (berrange) fedora-extras-commits at redhat.com
Fri Oct 5 01:53:52 UTC 2007


Author: berrange

Update of /cvs/pkgs/rpms/gtk-vnc/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13527

Modified Files:
	gtk-vnc.spec 
Added Files:
	gtk-vnc-0.2.0-coroutine-caller.patch 
Log Message:
Fixed coroutine caller to avoid crash in vinagre

gtk-vnc-0.2.0-coroutine-caller.patch:

--- NEW FILE gtk-vnc-0.2.0-coroutine-caller.patch ---
changeset:   76:949312711737
tag:         tip
user:        "Daniel P. Berrange <berrange at redhat.com>"
date:        Thu Oct 04 21:45:15 2007 -0400
files:       src/coroutine.c
description:
Fix to coroutine caller state management to avoid SEGV


diff -r ef58fe73ab0c -r 949312711737 src/coroutine.c
--- a/src/coroutine.c	Thu Oct 04 10:30:40 2007 -0300
+++ b/src/coroutine.c	Thu Oct 04 21:45:15 2007 -0400
@@ -11,6 +11,7 @@
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include "coroutine.h"
 
 int coroutine_release(struct coroutine *co)
@@ -57,25 +58,23 @@ int coroutine_init(struct coroutine *co)
 }
 
 #if 0
-static __thread struct coroutine system;
+static __thread struct coroutine leader;
 static __thread struct coroutine *current;
 #else
-static struct coroutine system;
+static struct coroutine leader;
 static struct coroutine *current;
 #endif
 
 struct coroutine *coroutine_self(void)
 {
 	if (current == NULL)
-		current = &system;
+		current = &leader;
 	return current;
 }
 
 void *coroutine_swap(struct coroutine *from, struct coroutine *to, void *arg)
 {
 	int ret;
-
-	to->caller = from;
 	to->data = arg;
 	current = to;
 	ret = cc_swap(&from->cc, &to->cc);
@@ -83,7 +82,7 @@ void *coroutine_swap(struct coroutine *f
 		return from->data;
 	else if (ret == 1) {
 		coroutine_release(to);
-		current = &system;
+		current = &leader;
 		to->exited = 1;
 		return to->data;
 	}
@@ -93,12 +92,23 @@ void *coroutine_swap(struct coroutine *f
 
 void *yieldto(struct coroutine *to, void *arg)
 {
+	if (to->caller) {
+		fprintf(stderr, "Co-routine is re-entering itself\n");
+		abort();
+	}
+	to->caller = coroutine_self();
 	return coroutine_swap(coroutine_self(), to, arg);
 }
 
 void *yield(void *arg)
 {
-	return yieldto(coroutine_self()->caller, arg);
+	struct coroutine *to = coroutine_self()->caller;
+	if (!to) {
+		fprintf(stderr, "Co-routine is yielding to no one\n");
+		abort();
+	}
+	coroutine_self()->caller = NULL;
+	return coroutine_swap(coroutine_self(), to, arg);
 }
 /*
  * Local variables:



Index: gtk-vnc.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gtk-vnc/devel/gtk-vnc.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- gtk-vnc.spec	26 Sep 2007 20:06:31 -0000	1.5
+++ gtk-vnc.spec	5 Oct 2007 01:53:20 -0000	1.6
@@ -3,11 +3,12 @@
 Summary: A GTK widget for VNC clients
 Name: gtk-vnc
 Version: 0.2.0
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: LGPLv2+
 Group: Development/Libraries
 Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
 Patch1: %{name}-%{version}-execmem.patch
+Patch2: %{name}-%{version}-coroutine-caller.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 URL: http://gtk-vnc.sf.net/
 BuildRequires: gtk2-devel pygtk2-devel python-devel gnutls-devel
@@ -43,6 +44,7 @@
 %prep
 %setup -q
 %patch1 -p1
+%patch2 -p1
 
 %build
 %configure
@@ -82,6 +84,9 @@
 %{_libdir}/python*/site-packages/gtkvnc.so
 
 %changelog
+* Thu Oct  4 2007 Daniel P. Berrange <berrange at redhat.com> - 0.2.0-3.fc8
+- Fixed coroutine caller to avoid SEGV
+
 * Wed Sep 26 2007 Daniel P. Berrange <berrange at redhat.com> - 0.2.0-2.fc8
 - Remove use of PROT_EXEC for coroutine stack (rhbz #307531 )
 




More information about the fedora-extras-commits mailing list