From 75479d77655e6e2e42cc4494ecf20ff9bd1500f0 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Feb 01 2017 01:50:38 +0000 Subject: Fix a few input thread lock issues causing intel crashes (#1384486) --- diff --git a/0001-xfree86-Take-input-lock-for-xf86TransparentCursor.patch b/0001-xfree86-Take-input-lock-for-xf86TransparentCursor.patch new file mode 100644 index 0000000..26aa511 --- /dev/null +++ b/0001-xfree86-Take-input-lock-for-xf86TransparentCursor.patch @@ -0,0 +1,34 @@ +From adccf461f12bc9f7df990e792659489d285890d4 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Mon, 16 Jan 2017 22:36:34 +0000 +Subject: [PATCH xserver] xfree86: Take input lock for xf86TransparentCursor + +--- + hw/xfree86/ramdac/xf86HWCurs.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c +index 55d5861..26dc7e5 100644 +--- a/hw/xfree86/ramdac/xf86HWCurs.c ++++ b/hw/xfree86/ramdac/xf86HWCurs.c +@@ -261,6 +261,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen) + xf86CursorScreenKey); + xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; + ++ input_lock(); ++ + if (!ScreenPriv->transparentData) + ScreenPriv->transparentData = + (*infoPtr->RealizeCursor) (infoPtr, NullCursor); +@@ -273,6 +275,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen) + ScreenPriv->transparentData); + + (*infoPtr->ShowCursor) (infoPtr->pScrn); ++ ++ input_unlock(); + } + + static void +-- +2.9.3 + diff --git a/0001-xfree86-Take-input_lock-for-xf86ScreenCheckHWCursor.patch b/0001-xfree86-Take-input_lock-for-xf86ScreenCheckHWCursor.patch new file mode 100644 index 0000000..00956c1 --- /dev/null +++ b/0001-xfree86-Take-input_lock-for-xf86ScreenCheckHWCursor.patch @@ -0,0 +1,62 @@ +From ecec69ff9a5b1bbdd4f8eae27ffce99bcf34fb65 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Fri, 20 Jan 2017 09:49:19 +0000 +Subject: [PATCH xserver] xfree86: Take input_lock() for + xf86ScreenCheckHWCursor + +--- + hw/xfree86/ramdac/xf86HWCurs.c | 27 ++++++++++++++++++++------- + 1 file changed, 20 insertions(+), 7 deletions(-) + +diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c +index 26dc7e5..7043a9c 100644 +--- a/hw/xfree86/ramdac/xf86HWCurs.c ++++ b/hw/xfree86/ramdac/xf86HWCurs.c +@@ -139,9 +139,14 @@ Bool + xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr) + { + ScreenPtr pSlave; ++ Bool use_hw_cursor = TRUE; + +- if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr)) +- return FALSE; ++ input_lock(); ++ ++ if (!xf86ScreenCheckHWCursor(pScreen, cursor, infoPtr)) { ++ use_hw_cursor = FALSE; ++ goto unlock; ++ } + + /* ask each driver consuming a pixmap if it can support HW cursor */ + xorg_list_for_each_entry(pSlave, &pScreen->slave_list, slave_head) { +@@ -151,14 +156,22 @@ xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr + continue; + + sPriv = dixLookupPrivate(&pSlave->devPrivates, xf86CursorScreenKey); +- if (!sPriv) /* NULL if Option "SWCursor", possibly other conditions */ +- return FALSE; ++ if (!sPriv) { /* NULL if Option "SWCursor", possibly other conditions */ ++ use_hw_cursor = FALSE; ++ break; ++ } + + /* FALSE if HWCursor not supported by slave */ +- if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) +- return FALSE; ++ if (!xf86ScreenCheckHWCursor(pSlave, cursor, sPriv->CursorInfoPtr)) { ++ use_hw_cursor = FALSE; ++ break; ++ } + } +- return TRUE; ++ ++unlock: ++ input_unlock(); ++ ++ return use_hw_cursor; + } + + static Bool +-- +2.9.3 + diff --git a/0001-xfree86-Take-the-input-lock-for-xf86RecolorCursor.patch b/0001-xfree86-Take-the-input-lock-for-xf86RecolorCursor.patch new file mode 100644 index 0000000..7e90616 --- /dev/null +++ b/0001-xfree86-Take-the-input-lock-for-xf86RecolorCursor.patch @@ -0,0 +1,76 @@ +From 9ac63cdf132f430bf4bf33561b15298538db6070 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Mon, 16 Jan 2017 22:17:36 +0000 +Subject: [PATCH xserver] xfree86: Take the input lock for xf86RecolorCursor + +xf86RecolorCursor() may be called directly from XRecolorCursor as well +as from xf86ScreenSetCursor(). In the latter case, the input lock is +already held, but not for the former and so we need to add a wrapper +function that acquires the input lock before performing +xf86RecolorCursor() + +References: https://bugs.freedesktop.org/show_bug.cgi?id=99358 +--- + hw/xfree86/ramdac/xf86HWCurs.c | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c +index 4481320..55d5861 100644 +--- a/hw/xfree86/ramdac/xf86HWCurs.c ++++ b/hw/xfree86/ramdac/xf86HWCurs.c +@@ -22,6 +22,9 @@ + + #include "servermd.h" + ++static void ++xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs); ++ + static CARD32 + xf86ReverseBitOrder(CARD32 v) + { +@@ -204,7 +207,7 @@ xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) + if (!xf86DriverLoadCursorImage (infoPtr, bits)) + return FALSE; + +- xf86RecolorCursor(pScreen, pCurs, 1); ++ xf86RecolorCursor_locked (ScreenPriv, pCurs); + + (*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y); + +@@ -312,12 +315,9 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y) + input_unlock(); + } + +-void +-xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) ++static void ++xf86RecolorCursor_locked(xf86CursorScreenPtr ScreenPriv, CursorPtr pCurs) + { +- xf86CursorScreenPtr ScreenPriv = +- (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, +- xf86CursorScreenKey); + xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; + + /* recoloring isn't applicable to ARGB cursors and drivers +@@ -357,6 +357,18 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) + } + } + ++void ++xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) ++{ ++ xf86CursorScreenPtr ScreenPriv = ++ (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, ++ xf86CursorScreenKey); ++ ++ input_lock(); ++ xf86RecolorCursor_locked (ScreenPriv, pCurs); ++ input_unlock(); ++} ++ + /* These functions assume that MaxWidth is a multiple of 32 */ + static unsigned char * + RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) +-- +2.9.3 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 45f7ed6..dea0c65 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -45,7 +45,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.19.1 -Release: 2%{?gitdate:.%{gitdate}}%{dist} +Release: 3%{?gitdate:.%{gitdate}}%{dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -102,10 +102,14 @@ Patch7025: 0001-Always-install-vbe-and-int10-sdk-headers.patch # Submitted upstream, but not going anywhere Patch7027: xserver-autobind-hotplug.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1384486 +Patch8000: 0001-xfree86-Take-input-lock-for-xf86TransparentCursor.patch +Patch8001: 0001-xfree86-Take-the-input-lock-for-xf86RecolorCursor.patch +Patch8002: 0001-xfree86-Take-input_lock-for-xf86ScreenCheckHWCursor.patch + # because the display-managers are not ready yet, do not upstream Patch10000: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch - %global moduledir %{_libdir}/xorg/modules %global drimoduledir %{_libdir}/dri %global sdkdir %{_includedir}/xorg @@ -598,6 +602,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Wed Feb 01 2017 Peter Hutterer 1.19.1-3 +- Fix a few input thread lock issues causing intel crashes (#1384486) + * Mon Jan 16 2017 Adam Jackson - 1.19.1-2 - Limit the intel driver only on F26 and up