Torsocks hangs on all QT5 applications running with Wayland
This bug affects Torsocks 2.3.0 and potentially earlier versions as well. Any application built using QT5 and running under Wayland will hang when running with Torsocks. You can verify this by trying to run for example Mumble on Fedora 32.
The reason for this is that the tsocks_recvmsg
call uses a prelimenary call to the real recvmsg
with the MSG_PEEK
flag, when trying to read from a domain socket, in order to check whether any socket file descriptors are being passed. The problem is that the QT5 implementation of Wayland client calls recvmsg
with the MSG_DONTWAIT
flag, which the tsocks_recvmsg
implementation ignores when doing the peek call - thus causing it to hang. The supported flags can be seen in the man page for recvmsg
, for example here: https://linux.die.net/man/2/recvmsg
The fix for this seems simple - I implemented it in this commit https://github.com/digitalautonomy/torsocks/commit/df7428523840c5e8a5289306b2785d0c6f05e6db. If there is no more subtlety in this implementation, feel free to merge this commit as is.