From: "Philip B. Krogh" <[email protected]>
_XReply can release the display lock while waiting for the server. Another thread can then reuse the output request buffer before XOpenDevice reads req->deviceid. Preserve the caller-supplied ID instead of reading the potentially overwritten request. A two-thread Xvfb test requests a valid pointer while a second thread sends XNoOp requests on the same display. Three unpatched libXi 1.8.4 runs returned device 127 for requested device 4. With this change, three runs completed 50000 open/map/close cycles each without an ID mismatch. No devices are removed and no input events are injected. Signed-off-by: Philip B. Krogh <[email protected]> --- This applies to libXi master 9ea632ab9dce9ad6630ef7db9d1850ea3d0a2419 (libXi 1.8.4). The reproducer uses two real threads and its own Xvfb server; it neither removes devices nor injects input. One thread opens and reads the mapping of a valid pointer while the other sends XNoOp requests on the same Display. Reproducer, Nix check, provenance and application-context limits: https://github.com/phibkro/hdt-proton-hyprland/pull/17 Run from that branch: nix build .#checks.x86_64-linux.libxi-regression --no-link The check expects three original-library mismatches and three patched 50000-cycle passes. Existing desktop driver files are unchanged. A Wine application exit prompted this investigation, but the library test is independent; the live application's patched acceptance remains pending. src/XOpenDev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/XOpenDev.c b/src/XOpenDev.c index 4b3c460..0859825 100644 --- a/src/XOpenDev.c +++ b/src/XOpenDev.c @@ -99,7 +99,7 @@ XOpenDevice( if (dev) { int dlen; /* data length */ - dev->device_id = req->deviceid; + dev->device_id = id; dev->num_classes = rep.num_classes; dev->classes = (XInputClassInfo *) ((char *)dev + sizeof(XDevice)); dlen = rep.num_classes * sizeof(xInputClassInfo); -- 2.55.0
