You are not logged in.

#1 2023-01-05 22:04:09

reD_Bo0n
Member
Registered: 2023-01-05
Posts: 7

[SOLVED] Team Fortress 2 Crash with newest lib32-libx11

TF2 crashes after the last update of lib32-libx11 to version 1.8.3-1.
The whole console of Steam outputs "Xlib: sequence lost (0x10000 > 0x1cf8) in reply type 0xc!" (with the latter Hex changing for every message) even without playing TF2, but just moving the mouse cursor inside Steam itself.

This problem stops appearing after downgrading to 1.8.2-2

Edit: Works now on lib32-libx11 1.8.4-1

Last edited by reD_Bo0n (2023-02-17 07:12:04)

Offline

#2 2023-01-05 22:59:33

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] Team Fortress 2 Crash with newest lib32-libx11

Offline

#3 2023-01-06 09:07:25

reD_Bo0n
Member
Registered: 2023-01-05
Posts: 7

Re: [SOLVED] Team Fortress 2 Crash with newest lib32-libx11

Seems to be it, but also for the 32-bit variant.
The 64-bit version seems to got a fix.

Offline

#4 2023-01-06 21:55:45

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] Team Fortress 2 Crash with newest lib32-libx11

If libx11 1.8.3-4 fixes the issues for 64bit what if you apply the patch to 32bit as below:

diff --git a/trunk/0001-Revert_Update_XPutBackEvent.diff b/trunk/0001-Revert_Update_XPutBackEvent.diff
new file mode 100644
index 0000000..e0b6bc5
--- /dev/null
+++ b/trunk/0001-Revert_Update_XPutBackEvent.diff
@@ -0,0 +1,56 @@
+From 88399e01be679bfcc9a5e8922ffe2c47f0e56dee Mon Sep 17 00:00:00 2001
+From: Yuxuan Shui <yshuiv7@gmail.com>
+Date: Tue, 3 Jan 2023 15:09:28 +0000
+Subject: [PATCH] Revert "Update XPutBackEvent() to support clients that put
+ back unpadded events"
+
+This reverts commit d6d6cba90215d323567fef13d6565756c9956f60.
+
+The reverted commit intended to fix the problem where an unpadded X
+event struct is passed into XPutBackEvent, by creating a padded struct
+with _XEventToWire and _XWireToEvent. However, _XWireToEvent updates the
+last sequence number in Display, which may cause xlib to complain about
+lost sequence numbers.
+
+IMO, the problem that commit tried to solve is a bug in the client
+library, and workaround it inside Xlib is bad practice, especially given
+the problem it caused. Plus, the offender cited in the original commit
+message, freeglut, has already fixed this problem.
+
+Fixes: #176 #174
+
+Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
+---
+ src/PutBEvent.c | 15 +--------------
+ 1 file changed, 1 insertion(+), 14 deletions(-)
+
+diff --git a/src/PutBEvent.c b/src/PutBEvent.c
+index f7b74b31..0f9df342 100644
+--- a/src/PutBEvent.c
++++ b/src/PutBEvent.c
+@@ -79,22 +79,9 @@ XPutBackEvent (
+     register XEvent *event)
+ 	{
+ 	int ret;
+-	xEvent wire = {0};
+-	XEvent lib = {0};
+-	Status (*fp)(Display *, XEvent *, xEvent *);
+-	int type = event->type & 0177;
+ 
+ 	LockDisplay(dpy);
+-	fp = dpy->wire_vec[type];
+-	if (fp == NULL)
+-		fp = _XEventToWire;
+-	ret = (*fp)(dpy, event, &wire);
+-	if (ret)
+-	{
+-		ret = (*dpy->event_vec[type])(dpy, &lib, &wire);
+-		if (ret)
+-			ret = _XPutBackEvent(dpy, &lib);
+-	}
++	ret = _XPutBackEvent(dpy, event);
+ 	UnlockDisplay(dpy);
+ 	return ret;
+ 	}
+-- 
+GitLab
diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 67eaa52..c68e118 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -11,15 +11,24 @@ depends=('lib32-libxcb' $_pkgbasename)
 makedepends=('xorg-util-macros' 'xorgproto' 'xtrans' 'gcc-multilib')
 license=('custom:XFREE86')
 options=('debug')
-source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.xz{,.sig})
+source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.xz{,.sig}
+        0001-Revert_Update_XPutBackEvent.diff)
 sha512sums=('bc862338fed855986659e9ffa641db6b36c3ac9abced590d1b164e3cc24446671936e3688cdca18393129c4ea41777977eeb37e87d8edc14d6cc5d194a9c0325'
-            'SKIP')
+            'SKIP'
+            '17c7c9ab82d7d9c587f4b0e3d8766a3ba26587222465afd94d821632cdea69d379ad151bd0d17c27715746a3040ea1e78fcf383e63db1e0094f45040e296d40c')
 validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # Alan Coopersmith <alanc@freedesktop.org>
 validpgpkeys+=('C41C985FDCF1E5364576638B687393EE37D128F8') # Matthieu Herrb <matthieu.herrb@laas.fr>
 validpgpkeys+=('3BB639E56F861FA2E86505690FDD682D974CA72A') # Matt Turner <mattst88@gmail.com>
 validpgpkeys+=('995ED5C8A6138EB0961F18474C09DD83CAAA50B2') # Adam Jackson <ajax@nwnk.net>
 #validpgpkeys+=('C383B778255613DFDB409D91DB221A6900000011') # "Keith Packard <keithp@keithp.com>"
 
+prepare() {
+  cd libX11-${pkgver}
+  # https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/180 // fixes also MR #176/#187
+  # should fix FS#76669; FS#69295; FS#76860
+  patch -Np1 -i ../0001-Revert_Update_XPutBackEvent.diff
+}
+
 build() {
   export CC="gcc -m32"
   export PKG_CONFIG="i686-pc-linux-gnu-pkg-config"

Offline

#5 2023-01-07 15:40:26

reD_Bo0n
Member
Registered: 2023-01-05
Posts: 7

Re: [SOLVED] Team Fortress 2 Crash with newest lib32-libx11

The "0001-Revert_Update_XPutBackEvent.diff" fixed the terminal spam, but not the crash.

I also grabbed the "176.diff" from libx11 1.8.3-5 and this seems to fix the whole situation.

Played some rounds, restarted my PC just to be safe ans still no crashes.

Offline

#6 2023-01-08 12:36:10

circl
Member
Registered: 2022-06-15
Posts: 3

Re: [SOLVED] Team Fortress 2 Crash with newest lib32-libx11

How can I apply this patch? Do I need to build from source?
EDIT: I RTFM'd

Last edited by circl (2023-01-08 12:47:46)

Offline

#7 2023-01-08 15:06:02

reD_Bo0n
Member
Registered: 2023-01-05
Posts: 7

Re: [SOLVED] Team Fortress 2 Crash with newest lib32-libx11

  1. Grab the PKGBUILD source for lib32-libx11 (with asp)

  2. Save the following block as "patch" inside the lib32-libx11 folder

    diff -N --unified --recursive --text lib32-libx11/0001-Revert_Update_XPutBackEvent.diff lib32-libx11_patched/0001-Revert_Update_XPutBackEvent.diff
    --- lib32-libx11/0001-Revert_Update_XPutBackEvent.diff	1970-01-01 01:00:00.000000000 +0100
    +++ lib32-libx11_patched/0001-Revert_Update_XPutBackEvent.diff	2023-01-07 15:38:39.413836679 +0100
    @@ -0,0 +1,56 @@
    +From 88399e01be679bfcc9a5e8922ffe2c47f0e56dee Mon Sep 17 00:00:00 2001
    +From: Yuxuan Shui <yshuiv7@gmail.com>
    +Date: Tue, 3 Jan 2023 15:09:28 +0000
    +Subject: [PATCH] Revert "Update XPutBackEvent() to support clients that put
    + back unpadded events"
    +
    +This reverts commit d6d6cba90215d323567fef13d6565756c9956f60.
    +
    +The reverted commit intended to fix the problem where an unpadded X
    +event struct is passed into XPutBackEvent, by creating a padded struct
    +with _XEventToWire and _XWireToEvent. However, _XWireToEvent updates the
    +last sequence number in Display, which may cause xlib to complain about
    +lost sequence numbers.
    +
    +IMO, the problem that commit tried to solve is a bug in the client
    +library, and workaround it inside Xlib is bad practice, especially given
    +the problem it caused. Plus, the offender cited in the original commit
    +message, freeglut, has already fixed this problem.
    +
    +Fixes: #176 #174
    +
    +Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
    +---
    + src/PutBEvent.c | 15 +--------------
    + 1 file changed, 1 insertion(+), 14 deletions(-)
    +
    +diff --git a/src/PutBEvent.c b/src/PutBEvent.c
    +index f7b74b31..0f9df342 100644
    +--- a/src/PutBEvent.c
    ++++ b/src/PutBEvent.c
    +@@ -79,22 +79,9 @@ XPutBackEvent (
    +     register XEvent *event)
    + 	{
    + 	int ret;
    +-	xEvent wire = {0};
    +-	XEvent lib = {0};
    +-	Status (*fp)(Display *, XEvent *, xEvent *);
    +-	int type = event->type & 0177;
    + 
    + 	LockDisplay(dpy);
    +-	fp = dpy->wire_vec[type];
    +-	if (fp == NULL)
    +-		fp = _XEventToWire;
    +-	ret = (*fp)(dpy, event, &wire);
    +-	if (ret)
    +-	{
    +-		ret = (*dpy->event_vec[type])(dpy, &lib, &wire);
    +-		if (ret)
    +-			ret = _XPutBackEvent(dpy, &lib);
    +-	}
    ++	ret = _XPutBackEvent(dpy, event);
    + 	UnlockDisplay(dpy);
    + 	return ret;
    + 	}
    +-- 
    +GitLab
    diff -N --unified --recursive --text lib32-libx11/176.diff lib32-libx11_patched/176.diff
    --- lib32-libx11/176.diff	1970-01-01 01:00:00.000000000 +0100
    +++ lib32-libx11_patched/176.diff	2023-01-07 12:47:06.000000000 +0100
    @@ -0,0 +1,189 @@
    +diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
    +index e20c4833c16c6d3518e4b7feb9bdbc606584bfcc..b570bd01c657f4d86f06b414a43e96da4319f729 100644
    +--- a/include/X11/Xlibint.h
    ++++ b/include/X11/Xlibint.h
    +@@ -43,6 +43,10 @@ from The Open Group.
    + #include <X11/Xproto.h>		/* to declare xEvent */
    + #include <X11/XlibConf.h>	/* for configured options like XTHREADS */
    + 
    ++#ifdef XTHREADS
    ++#include <X11/Xthreads.h>
    ++#endif
    ++
    + /* The Xlib structs are full of implicit padding to properly align members.
    +    We can't clean that up without breaking ABI, so tell clang not to bother
    +    complaining about it. */
    +@@ -207,7 +211,10 @@ struct _XDisplay
    + 
    + 	XIOErrorExitHandler exit_handler;
    + 	void *exit_handler_data;
    +-        CARD32 in_ifevent;
    ++	CARD32 in_ifevent;
    ++#ifdef XTHREADS
    ++    xthread_t ifevent_thread;
    ++#endif
    + };
    + 
    + #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
    +diff --git a/src/ChkIfEv.c b/src/ChkIfEv.c
    +index b32c2d3ebcb1aad0e704a3e5dce52dc31971afd2..666366966a0e81bf413a64e015a84da1fcf5cdf0 100644
    +--- a/src/ChkIfEv.c
    ++++ b/src/ChkIfEv.c
    +@@ -49,8 +49,11 @@ Bool XCheckIfEvent (
    + 	unsigned long qe_serial = 0;
    + 	int n;			/* time through count */
    + 
    +-	dpy->in_ifevent++;
    + 	LockDisplay(dpy);
    ++#ifdef XTHREADS
    ++	dpy->ifevent_thread = xthread_self();
    ++#endif
    ++	dpy->in_ifevent++;
    + 	prev = NULL;
    + 	for (n = 3; --n >= 0;) {
    + 	    for (qelt = prev ? prev->next : dpy->head;
    +diff --git a/src/IfEvent.c b/src/IfEvent.c
    +index 54c37f0031b27f3d7eb629ec2ea16b615b29e734..35c592e3a54d89f1d2ac1efa40c43a04eab1c0c5 100644
    +--- a/src/IfEvent.c
    ++++ b/src/IfEvent.c
    +@@ -48,8 +48,11 @@ XIfEvent (
    + 	register _XQEvent *qelt, *prev;
    + 	unsigned long qe_serial = 0;
    + 
    +-	dpy->in_ifevent++;
    + 	LockDisplay(dpy);
    ++#ifdef XTHREADS
    ++	dpy->ifevent_thread = xthread_self();
    ++#endif
    ++	dpy->in_ifevent++;
    + 	prev = NULL;
    + 	while (1) {
    + 	    for (qelt = prev ? prev->next : dpy->head;
    +diff --git a/src/PeekIfEv.c b/src/PeekIfEv.c
    +index 68c028b70705968c6757c1e70a238886a94adecb..754749a77c0835c0ba3c1aa6edded15dab7fb478 100644
    +--- a/src/PeekIfEv.c
    ++++ b/src/PeekIfEv.c
    +@@ -49,8 +49,11 @@ XPeekIfEvent (
    + 	register _XQEvent *prev, *qelt;
    + 	unsigned long qe_serial = 0;
    + 
    +-	dpy->in_ifevent++;
    + 	LockDisplay(dpy);
    ++#ifdef XTHREADS
    ++	dpy->ifevent_thread = xthread_self();
    ++#endif
    ++	dpy->in_ifevent++;
    + 	prev = NULL;
    + 	while (1) {
    + 	    for (qelt = prev ? prev->next : dpy->head;
    +diff --git a/src/locking.c b/src/locking.c
    +index c550603e1f5d0601af3fa19c0b8486ef5b1bc30f..642cf9894268dfbbb79a104b42b4097cfd293d82 100644
    +--- a/src/locking.c
    ++++ b/src/locking.c
    +@@ -240,7 +240,9 @@ static void _XUnlockDisplay(
    +     if (lock_hist_loc >= LOCK_HIST_SIZE)
    + 	lock_hist_loc = 0;
    + #endif /* XTHREADS_WARN */
    +-    xmutex_unlock(dpy->lock->mutex);
    ++
    ++    if (dpy->in_ifevent == 0 || dpy->ifevent_thread != xthread_self())
    ++        xmutex_unlock(dpy->lock->mutex);
    + }
    + 
    + 
    +@@ -453,63 +455,24 @@ static void _XDisplayLockWait(
    + }
    + 
    + static void _XLockDisplay(
    +-    Display *dpy
    +-    XTHREADS_FILE_LINE_ARGS
    +-    );
    +-
    +-static void _XIfEventLockDisplay(
    +     Display *dpy
    +     XTHREADS_FILE_LINE_ARGS
    +     )
    + {
    +-    /* assert(dpy->in_ifevent); */
    +-}
    ++    struct _XErrorThreadInfo *ti;
    + 
    +-static void _XInternalLockDisplay(
    +-    Display *dpy,
    +-    Bool wskip
    +-    XTHREADS_FILE_LINE_ARGS
    +-    );
    ++    if (dpy->in_ifevent && dpy->ifevent_thread == xthread_self())
    ++        return;
    + 
    +-static void _XIfEventInternalLockDisplay(
    +-    Display *dpy,
    +-    Bool wskip
    +-    XTHREADS_FILE_LINE_ARGS
    +-    )
    +-{
    +-    /* assert(dpy->in_ifevent); */
    +-}
    +-
    +-static void _XIfEventUnlockDisplay(
    +-    Display *dpy
    +-    XTHREADS_FILE_LINE_ARGS
    +-    )
    +-{
    +-    if (dpy->in_ifevent == 0) {
    +-	dpy->lock_fns->lock_display = _XLockDisplay;
    +-	dpy->lock_fns->unlock_display = _XUnlockDisplay;
    +-	dpy->lock->internal_lock_display = _XInternalLockDisplay;
    +-	UnlockDisplay(dpy);
    +-    } else
    +-	return;
    +-}
    +-
    +-static void _XLockDisplay(
    +-    Display *dpy
    +-    XTHREADS_FILE_LINE_ARGS
    +-    )
    +-{
    +-#ifdef XTHREADS
    +-    struct _XErrorThreadInfo *ti;
    +-#endif
    + #ifdef XTHREADS_WARN
    +     _XLockDisplayWarn(dpy, file, line);
    + #else
    +     xmutex_lock(dpy->lock->mutex);
    + #endif
    ++
    +     if (dpy->lock->locking_level > 0)
    +-	_XDisplayLockWait(dpy);
    +-#ifdef XTHREADS
    ++    _XDisplayLockWait(dpy);
    ++
    +     /*
    +      * Skip the two function calls below which may generate requests
    +      * when LockDisplay is called from within _XError.
    +@@ -517,14 +480,9 @@ static void _XLockDisplay(
    +     for (ti = dpy->error_threads; ti; ti = ti->next)
    + 	    if (ti->error_thread == xthread_self())
    + 		    return;
    +-#endif
    ++
    +     _XIDHandler(dpy);
    +     _XSeqSyncFunction(dpy);
    +-    if (dpy->in_ifevent) {
    +-	dpy->lock_fns->lock_display = _XIfEventLockDisplay;
    +-	dpy->lock_fns->unlock_display = _XIfEventUnlockDisplay;
    +-	dpy->lock->internal_lock_display = _XIfEventInternalLockDisplay;
    +-    }
    + }
    + 
    + /*
    +@@ -537,6 +495,9 @@ static void _XInternalLockDisplay(
    +     XTHREADS_FILE_LINE_ARGS
    +     )
    + {
    ++    if (dpy->in_ifevent && dpy->ifevent_thread == xthread_self())
    ++        return;
    ++
    + #ifdef XTHREADS_WARN
    +     _XLockDisplayWarn(dpy, file, line);
    + #else
    diff -N --unified --recursive --text lib32-libx11/PKGBUILD lib32-libx11_patched/PKGBUILD
    --- lib32-libx11/PKGBUILD	2023-01-04 18:53:54.000000000 +0100
    +++ lib32-libx11_patched/PKGBUILD	2023-01-07 16:03:57.927554131 +0100
    @@ -11,15 +11,27 @@
     makedepends=('xorg-util-macros' 'xorgproto' 'xtrans' 'gcc-multilib')
     license=('custom:XFREE86')
     options=('debug')
    -source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.xz{,.sig})
    +source=(${url}/releases/individual/lib/libX11-${pkgver}.tar.xz{,.sig}
    +        0001-Revert_Update_XPutBackEvent.diff
    +        176.diff)
     sha512sums=('bc862338fed855986659e9ffa641db6b36c3ac9abced590d1b164e3cc24446671936e3688cdca18393129c4ea41777977eeb37e87d8edc14d6cc5d194a9c0325'
    -            'SKIP')
    +            'SKIP'
    +            '17c7c9ab82d7d9c587f4b0e3d8766a3ba26587222465afd94d821632cdea69d379ad151bd0d17c27715746a3040ea1e78fcf383e63db1e0094f45040e296d40c'
    +            '6f5a06e7191b355e5adf48c3391ba66dc2482673b1a485f4c53253c1b800847b9c20c006140b1775644dbd6c77668e588b7df9d6f23aee3e3c9d36b7135c3f8b')
     validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # Alan Coopersmith <alanc@freedesktop.org>
     validpgpkeys+=('C41C985FDCF1E5364576638B687393EE37D128F8') # Matthieu Herrb <matthieu.herrb@laas.fr>
     validpgpkeys+=('3BB639E56F861FA2E86505690FDD682D974CA72A') # Matt Turner <mattst88@gmail.com>
     validpgpkeys+=('995ED5C8A6138EB0961F18474C09DD83CAAA50B2') # Adam Jackson <ajax@nwnk.net>
     #validpgpkeys+=('C383B778255613DFDB409D91DB221A6900000011') # "Keith Packard <keithp@keithp.com>"
     
    +prepare() {
    +  cd libX11-${pkgver}
    +  # https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/180 // fixes also MR #176/#187
    +  # should fix FS#76669; FS#69295; FS#76860
    +  patch -Np1 -i ../0001-Revert_Update_XPutBackEvent.diff
    +  patch -Np1 -i ../176.diff
    +}
    +
     build() {
       export CC="gcc -m32"
       export PKG_CONFIG="i686-pc-linux-gnu-pkg-config"
  3. run

    patch --strip=1 --input="patch"
  4. install via

    makepkg -si --skippgpcheck

I hope my patch works alright

Offline

#8 2023-02-17 07:12:10

reD_Bo0n
Member
Registered: 2023-01-05
Posts: 7

Re: [SOLVED] Team Fortress 2 Crash with newest lib32-libx11

Works now on lib32-libx11 1.8.4-1

Offline

Board footer

Powered by FluxBB