From owner-freebsd-current@FreeBSD.ORG Sun Sep 18 01:30:07 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A98A716A41F; Sun, 18 Sep 2005 01:30:07 +0000 (GMT) (envelope-from dejan.lesjak@ijs.si) Received: from mail.ijs.si (mail.ijs.si [193.2.4.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id ECDBE43D45; Sun, 18 Sep 2005 01:30:06 +0000 (GMT) (envelope-from dejan.lesjak@ijs.si) Received: from localhost (mail.ijs.si [193.2.4.66]) by patsy.ijs.si (Postfix) with ESMTP id 43A1117B859; Sun, 18 Sep 2005 03:30:05 +0200 (CEST) Received: from patsy.ijs.si ([127.0.0.1]) by localhost (patsy.ijs.si [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 16741-01; Sun, 18 Sep 2005 03:30:00 +0200 (CEST) Received: from radagast.ijs.si (radagast.ijs.si [193.2.4.168]) by patsy.ijs.si (Postfix) with ESMTP id B58EE17B855; Sun, 18 Sep 2005 03:29:59 +0200 (CEST) Received: from localhost.ijs.si (localhost.ijs.si [127.0.0.1]) by radagast.ijs.si (Postfix) with ESMTP id 813251702B; Sun, 18 Sep 2005 03:29:59 +0200 (CEST) From: Dejan Lesjak To: freebsd-x11@freebsd.org, robbak@gmail.com Date: Sun, 18 Sep 2005 03:29:56 +0200 User-Agent: KMail/1.8.2 References: <432AF297.80203@charter.net> In-Reply-To: X-Face: %~f=_)D]BD:EmnBSk5TR|!pcMoc_Ohnn, wh02@'h@*ylg@w}ur$a@0nU2hg~PdH4"vw<=?utf-8?q?4g=0A=09fFrrU44=60z?="]BC%`Y@tv(J*F&o%7EA5<, h`CxOHZq|c:O>|yXElz^Bbsp!QLojjP MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_WMMLDVO9ESMVAqT" Message-Id: <200509180329.58967.dejan.lesjak@ijs.si> X-Virus-Scanned: amavisd-new at ijs.si Cc: freebsd-current@freebsd.org, gerald@freebsd.org, bob self Subject: Re: can't run wine anymore X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2005 01:30:07 -0000 --Boundary-00=_WMMLDVO9ESMVAqT Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sunday 18 of September 2005 02:57, Robert Backhaus wrote: > On 9/16/05, bob self wrote: > > I'm running 6.0 beta 4 and after doing a nightly portupgrade a couple of > > nights ago I can no longer run > > wine. Six ports upgraded sucessfully, including xorg-server. I get this > > message now when I run wine: > > > > X Error of failed request: BadAlloc (insufficient resources for > > operation) Major opcode of failed request: 53 (X_CreatePixmap) > > Serial number of failed request: 12785 > > Current serial number in output stream: 12787 > > X Error of failed request: BadAlloc (insufficient resources for > > operation) Major opcode of failed request: 53 (X_CreatePixmap) > > Serial number of failed request: 12785 > > Current serial number in output stream: 12787 > > > > Does anyone know what this means or what is causing it? > > It's in the wine bug list, see the link below. Many people are working > on it. It seems to be caused by an xorg upgrade. There are many people > working on a fix, so it shouldn't take long. According to the bug > report, removing that patch resolves the issue. (It appears to be the > file "files/patch-CAN-2005-2495". I'll try it soon. I'm cc-ing > gerald, the wine maintainer, and the x11 maillist. > > http://bugs.winehq.org/show_bug.cgi?id=3336 Can you please try replacing patch-CAN-2005-2495 with the attached one (also at http://www.ijs.si/~lesi/xorg/patch-CAN-2005-2495-take2). This is the version that was actually committed to Xorg CVS. Dejan --Boundary-00=_WMMLDVO9ESMVAqT Content-Type: text/plain; charset="iso-8859-1"; name="patch-CAN-2005-2495-take2" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-CAN-2005-2495-take2" Index: programs/Xserver/afb/afbpixmap.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/afb/afbpixmap.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- programs/Xserver/afb/afbpixmap.c 3 Jul 2005 07:01:14 -0000 1.5 +++ programs/Xserver/afb/afbpixmap.c 13 Sep 2005 01:33:18 -0000 1.6 @@ -77,10 +77,14 @@ int depth; { PixmapPtr pPixmap; - int datasize; - int paddedWidth; + size_t datasize; + size_t paddedWidth; paddedWidth = BitmapBytePad(width); + + if (paddedWidth > 32767 || height > 32767 || depth > 4) + return NullPixmap; + datasize = height * paddedWidth * depth; pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) Index: programs/Xserver/cfb/cfbpixmap.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/cfb/cfbpixmap.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- programs/Xserver/cfb/cfbpixmap.c 3 Jul 2005 07:01:15 -0000 1.5 +++ programs/Xserver/cfb/cfbpixmap.c 13 Sep 2005 01:33:19 -0000 1.6 @@ -72,10 +72,13 @@ int depth; { PixmapPtr pPixmap; - int datasize; - int paddedWidth; + size_t datasize; + size_t paddedWidth; paddedWidth = PixmapBytePad(width, depth); + + if (paddedWidth / 4 > 32767 || height > 32767) + return NullPixmap; datasize = height * paddedWidth; pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) Index: programs/Xserver/dix/dispatch.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/dix/dispatch.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- programs/Xserver/dix/dispatch.c 16 Jul 2005 20:52:25 -0000 1.12 +++ programs/Xserver/dix/dispatch.c 13 Sep 2005 01:33:19 -0000 1.13 @@ -1483,6 +1483,23 @@ client->errorValue = 0; return BadValue; } + if (stuff->width > 32767 || stuff->height > 32767) + { + /* It is allowed to try and allocate a pixmap which is larger than + * 32767 in either dimension. However, all of the framebuffer code + * is buggy and does not reliably draw to such big pixmaps, basically + * because the Region data structure operates with signed shorts + * for the rectangles in it. + * + * Furthermore, several places in the X server computes the + * size in bytes of the pixmap and tries to store it in an + * integer. This integer can overflow and cause the allocated size + * to be much smaller. + * + * So, such big pixmaps are rejected here with a BadAlloc + */ + return BadAlloc; + } if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; Index: programs/Xserver/dix/pixmap.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/dix/pixmap.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- programs/Xserver/dix/pixmap.c 3 Jul 2005 08:53:38 -0000 1.7 +++ programs/Xserver/dix/pixmap.c 13 Sep 2005 01:33:19 -0000 1.8 @@ -118,6 +118,9 @@ unsigned size; int i; + if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) + return NullPixmap; + pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize); if (!pPixmap) return NullPixmap; Index: programs/Xserver/fb/fbpixmap.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/fb/fbpixmap.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- programs/Xserver/fb/fbpixmap.c 3 Jul 2005 07:01:23 -0000 1.5 +++ programs/Xserver/fb/fbpixmap.c 13 Sep 2005 01:33:19 -0000 1.6 @@ -36,12 +36,14 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp) { PixmapPtr pPixmap; - int datasize; - int paddedWidth; + size_t datasize; + size_t paddedWidth; int adjust; int base; paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits); + if (paddedWidth / 4 > 32767 || height > 32767) + return NullPixmap; datasize = height * paddedWidth; #ifdef PIXPRIV base = pScreen->totalPixmapSize; Index: programs/Xserver/hw/xfree86/xaa/xaaInit.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- programs/Xserver/hw/xfree86/xaa/xaaInit.c 3 Jul 2005 08:53:49 -0000 1.7 +++ programs/Xserver/hw/xfree86/xaa/xaaInit.c 13 Sep 2005 01:33:19 -0000 1.8 @@ -502,6 +502,9 @@ XAAPixmapPtr pPriv; PixmapPtr pPix = NULL; int size = w * h; + + if (w > 32767 || h > 32767) + return NullPixmap; if (!infoRec->offscreenDepthsInitialized) XAAInitializeOffscreenDepths (pScreen); Index: programs/Xserver/hw/xfree86/xf4bpp/ppcPixmap.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/hw/xfree86/xf4bpp/ppcPixmap.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- programs/Xserver/hw/xfree86/xf4bpp/ppcPixmap.c 3 Jul 2005 07:01:41 -0000 1.3 +++ programs/Xserver/hw/xfree86/xf4bpp/ppcPixmap.c 13 Sep 2005 01:33:19 -0000 1.4 @@ -89,7 +89,7 @@ int depth ; { register PixmapPtr pPixmap = (PixmapPtr)NULL; - int size ; + size_t size ; TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d, depth=%d)\n", pScreen, width, height, depth)) ; @@ -97,6 +97,10 @@ return (PixmapPtr) NULL ; size = PixmapBytePad(width, depth); + + if (size / 4 > 32767 || height > 32767) + return (PixmapPtr) NULL ; + pPixmap = AllocatePixmap (pScreen, (height * size)); if ( !pPixmap ) Index: programs/Xserver/ilbm/ilbmpixmap.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/ilbm/ilbmpixmap.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- programs/Xserver/ilbm/ilbmpixmap.c 3 Jul 2005 07:01:44 -0000 1.4 +++ programs/Xserver/ilbm/ilbmpixmap.c 13 Sep 2005 01:33:19 -0000 1.5 @@ -79,10 +79,12 @@ int depth; { PixmapPtr pPixmap; - int datasize; - int paddedWidth; + size_t datasize; + size_t paddedWidth; paddedWidth = BitmapBytePad(width); + if (paddedWidth > 32767 || height > 32767 || depth > 4) + return NullPixmap; datasize = height * paddedWidth * depth; pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) Index: programs/Xserver/iplan2p4/iplpixmap.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/iplan2p4/iplpixmap.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- programs/Xserver/iplan2p4/iplpixmap.c 3 Jul 2005 07:01:46 -0000 1.4 +++ programs/Xserver/iplan2p4/iplpixmap.c 13 Sep 2005 01:33:19 -0000 1.5 @@ -78,12 +78,14 @@ int depth; { PixmapPtr pPixmap; - int datasize; - int paddedWidth; + size_t datasize; + size_t paddedWidth; int ipad=INTER_PLANES*2 - 1; paddedWidth = PixmapBytePad(width, depth); paddedWidth = (paddedWidth + ipad) & ~ipad; + if (paddedWidth / 4 > 32767 || height > 32767) + return NullPixmap; datasize = height * paddedWidth; pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) Index: programs/Xserver/mfb/mfbpixmap.c =================================================================== RCS file: /epruveta/repos/xorg/xorg/xc/programs/Xserver/mfb/mfbpixmap.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- programs/Xserver/mfb/mfbpixmap.c 3 Jul 2005 07:01:50 -0000 1.4 +++ programs/Xserver/mfb/mfbpixmap.c 13 Sep 2005 01:33:19 -0000 1.5 @@ -75,12 +75,14 @@ int depth; { PixmapPtr pPixmap; - int datasize; - int paddedWidth; + size_t datasize; + size_t paddedWidth; if (depth != 1) return NullPixmap; paddedWidth = BitmapBytePad(width); + if (paddedWidth / 4 > 32767 || height > 32767) + return NullPixmap; datasize = height * paddedWidth; pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) --Boundary-00=_WMMLDVO9ESMVAqT--