This morning I spent a few hours tracking down a bug in wlroots' X11 backend. Importing a DMA-BUF via the X11 DRI3 extension failed, and I couldn't understand why.

Went from X.Org server core to Xwayland to GBM to Gallium to radeonsi to libdrm to the kernel. The FD seemed valid, since stat() didn't return an error, but drmPrimeFDToHandle failed.


It turns out sending a closed FD via XCB doesn't fail. The other side (X.Org server) just receives a random FD number, which I think by chance referred to an unrelated FD which was opened.

But why was I sending a closed FD via XCB in the first place? It turns out sending a FD via XCB also closes it. So it worked fine the first time, and caused the bug the second time.

· · Web · 2 · 0 · 2

So, yeah, *&%*($ to silently ignoring errors, XCB.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!