[Frugalware-git] xorgtesting: xorg-server-1.8.1-3-i686 *added fix for FreeResource

bouleetbil bouleetbil at frogdev.info
Mon Jun 14 22:52:00 CEST 2010


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=xorgtesting.git;a=commitdiff;h=9bd33ceda55c3ad8a06cced03b899a991b9654d9

commit 9bd33ceda55c3ad8a06cced03b899a991b9654d9
Author: bouleetbil <bouleetbil at frogdev.info>
Date:   Mon Jun 14 22:57:24 2010 +0000

xorg-server-1.8.1-3-i686
*added fix for FreeResource

diff --git a/source/x11/xorg-server/FixFreeResource.diff b/source/x11/xorg-server/FixFreeResource.diff
new file mode 100644
index 0000000..3a81a01
--- /dev/null
+++ b/source/x11/xorg-server/FixFreeResource.diff
@@ -0,0 +1,82 @@
+From 6d7ba5e0fcb5d1bce6bb213dec009f3a0f802d26 Mon Sep 17 00:00:00 2001
+From: Kristian Høgsberg <krh at bitplanet.net>
+Date: Sat, 01 May 2010 17:07:46 +0000
+Subject: dix: Update element count in FreeResource*()
+
+FreeResource() keeps clientTable[cid].elements up to date with the
+number of resources allocated to the client.  The other free
+resource functions (FreeResourceByType(),
+FreeClientNeverRetainResources() and FreeClientResources()) don't
+maintain this invariant.
+
+Typically, the only consequence is that the element count is too high
+and we end up allocating the hash table bigger than necessary.  However,
+FreeResource() also relies on the element count to restart the search if
+the list of resources has been changed during a resource destruction
+callback.  Since FreeResourceByType() doesn't update the count, if we call
+that from a resource destruction callback from FreeResource(), the
+loop isn't restarted and we end up following an invalid next pointer.
+
+Furthermore, LookupClientResourceComplex() and
+FreeClientNeverRetainResources() don't use the element count to detect
+if a callback deleted a resource and may end up following an invalid
+next pointer if the resource system is called into recursively.
+
+Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
+Reviewed-by: Keith Packard <keithp at keithp.com>
+---
+diff --git a/dix/resource.c b/dix/resource.c
+index 91d0cfb..ab3762e 100644
+--- a/dix/resource.c
++++ b/dix/resource.c
+@@ -589,6 +589,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
+ 			      res->value, TypeNameString(res->type));
+ #endif
+ 		*prev = res->next;
++		clientTable[cid].elements--;
+
+ 		CallResourceStateCallback(ResourceStateFreeing, res);
+
+@@ -734,12 +735,14 @@ FreeClientNeverRetainResources(ClientPtr client)
+     ResourcePtr *resources;
+     ResourcePtr this;
+     ResourcePtr *prev;
+-    int j;
++    int j, elements;
++    int *eltptr;
+
+     if (!client)
+ 	return;
+
+     resources = clientTable[client->index].resources;
++    eltptr = &clientTable[client->index].elements;
+     for (j=0; j < clientTable[client->index].buckets; j++)
+     {
+ 	prev = &resources[j];
+@@ -753,11 +756,15 @@ FreeClientNeverRetainResources(ClientPtr client)
+ 			      this->value, TypeNameString(this->type));
+ #endif
+ 		*prev = this->next;
++		clientTable[client->index].elements--;
+
+ 		CallResourceStateCallback(ResourceStateFreeing, this);
+
++		elements = *eltptr;
+ 		(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
+ 		xfree(this);
++		if (*eltptr != elements)
++		    prev = &resources[j]; /* prev may no longer be valid */
+ 	    }
+ 	    else
+ 		prev = &this->next;
+@@ -804,6 +811,7 @@ FreeClientResources(ClientPtr client)
+ 			  this->value, TypeNameString(this->type));
+ #endif
+ 	    *head = this->next;
++	    clientTable[client->index].elements--;
+
+ 	    CallResourceStateCallback(ResourceStateFreeing, this);
+
+--
+cgit v0.8.3-6-g21f6
+
diff --git a/source/x11/xorg-server/FrugalBuild b/source/x11/xorg-server/FrugalBuild
index b3e1649..cfdb09c 100644
--- a/source/x11/xorg-server/FrugalBuild
+++ b/source/x11/xorg-server/FrugalBuild
@@ -10,7 +10,7 @@ USE_MULTIBUFFER=${USE_MULTIBUFFER:-"n"}

pkgname=xorg-server
pkgver=1.8.1
-pkgrel=2
+pkgrel=3
pkgdesc="Modular X.Org X Server"
groups=('x11' 'xorg-core')
archs=('i686' 'x86_64' 'ppc')
@@ -36,12 +36,14 @@ backup=('etc/sysconfig/desktop' 'etc/X11/xorg.conf.d/10-evdev.conf' \
'etc/X11/xorg.conf.d/20-synaptics.conf')
Finclude sourceforge xorg
source=(${source[@]} \
-	desktop 10-evdev.conf 20-synaptics.conf)
+	desktop 10-evdev.conf 20-synaptics.conf \
+	FixFreeResource.diff)

sha1sums=('cba0d3b3d28696609a1f9b110d4d129cd066e133' \
'676c8ad10a362615ae54de825e37c18c1f69ae08' \
'75f196f82ae19a335b83971b6fbb0f49a9bf6a58' \
-          '6c0156d129ddd2fb5277b76af1738298c2d09d4d')
+          '6c0156d129ddd2fb5277b76af1738298c2d09d4d' \
+          '342389521fe270edbfc0c746db1da72169a3b0a9')

if Fuse $USE_DEVEL; then
pkgver=1.6.3.901.151.g120286a


More information about the Frugalware-git mailing list