RDP-backend crash after failed connection from Windows 10 mstsc
Environment
- Ubuntu 20.04.1 (Server)
- Weson 8.0.0-1 (From apt source)
How to reproduce
Run a fresh Ubuntu Focal server image, install Weston
by apt, launch with
weston --rdp-tls-cert=tls.crt --rdp-tls-key=tls.key --backend=rdp-backend.so
Now connect to the RDP server from Windows 20H2 with audio and local resource redirection disabled, resolution set to 1920x1080 (altering the arguments seems have no affect to the result).
Then an internal error might occur. Sometimes it connects normally, like 50% of chance, sometimes it will give this Interal Error messagebox and quit.
Log is
[15:41:38:855] [12885:12885] [ERROR][com.freerdp.core.peer] - peer_recv_callback: CONNECTION_STATE_ACTIVE - peer_recv_pdu() fail
[15:41:38:855] [12885:12885] [ERROR][com.freerdp.core.transport] - transport_check_fds: transport->ReceiveCallback() - -1
[15:41:38.950] unable to checkDescriptor for 0x5601bb2125b0
[15:41:41:328] [12885:12885] [INFO][com.freerdp.core.connection] - Client Security: NLA:1 TLS:1 RDP:0
[15:41:41:328] [12885:12885] [INFO][com.freerdp.core.connection] - Server Security: NLA:0 TLS:1 RDP:1
[15:41:41:328] [12885:12885] [INFO][com.freerdp.core.connection] - Negotiated Security: NLA:0 TLS:1 RDP:0
[15:41:41:345] [12885:12885] [INFO][com.freerdp.core.connection] - Accepted client: WORK-PC
[15:41:41:345] [12885:12885] [INFO][com.freerdp.core.connection] - Accepted channels:
[15:41:41:345] [12885:12885] [INFO][com.freerdp.core.connection] - rdpdr
[15:41:41:345] [12885:12885] [INFO][com.freerdp.core.connection] - rdpsnd
[15:41:41:345] [12885:12885] [INFO][com.freerdp.core.connection] - cliprdr
[15:41:41:345] [12885:12885] [INFO][com.freerdp.core.connection] - drdynvc
[15:41:41:345] [12885:12885] [INFO][com.freerdp.core.gcc] - Active rdp encryption level: NONE
[15:41:41:345] [12885:12885] [INFO][com.freerdp.core.gcc] - Selected rdp encryption method: NONE
[15:41:41.491] kbd_layout:0x409 kbd_type:0x4 kbd_subType:0x0 kbd_functionKeys:0xc
[15:41:41.491] xf_peer_activate: matching layout=us variant=(null)
[15:41:41:404] [12885:12885] [WARN][com.freerdp.core.surface] - SURFACE_BITS_COMMAND->cmdType 0x0000 not allowed, correcting to 0x0006
[15:41:41:416] [12885:12885] [WARN][com.freerdp.core.surface] - SURFACE_BITS_COMMAND->cmdType 0x0000 not allowed, correcting to 0x0006
[15:41:41:416] [12885:12885] [ERROR][com.freerdp.core.transport] - BIO_should_retry returned a system error 104: Connection reset by peer
[15:41:41:416] [12885:12885] [ERROR][com.freerdp.core] - transport_write:freerdp_set_last_error_ex ERRCONNECT_CONNECT_TRANSPORT_FAILED [0x0002000D]
[15:41:41:416] [12885:12885] [ERROR][com.freerdp.core.transport] - BIO_read returned a system error 0: Success
[15:41:41.510] unable to checkDescriptor for 0x5601bb6746f0
Now if you try to connect again, you will get
Then weston will get segfault and quit, here is the log (right after above)
[15:42:09:218] [12885:12885] [INFO][com.freerdp.core.connection] - Client Security: NLA:1 TLS:1 RDP:0
[15:42:09:218] [12885:12885] [INFO][com.freerdp.core.connection] - Server Security: NLA:0 TLS:1 RDP:1
[15:42:09:218] [12885:12885] [INFO][com.freerdp.core.connection] - Negotiated Security: NLA:0 TLS:1 RDP:0
[15:42:09:222] [12885:12885] [INFO][com.freerdp.core.connection] - Accepted client: WORK-PC
[15:42:09:222] [12885:12885] [INFO][com.freerdp.core.connection] - Accepted channels:
[15:42:09:222] [12885:12885] [INFO][com.freerdp.core.connection] - rdpdr
[15:42:09:222] [12885:12885] [INFO][com.freerdp.core.connection] - rdpsnd
[15:42:09:222] [12885:12885] [INFO][com.freerdp.core.connection] - cliprdr
[15:42:09:222] [12885:12885] [INFO][com.freerdp.core.connection] - drdynvc
[15:42:09:222] [12885:12885] [INFO][com.freerdp.core.gcc] - Active rdp encryption level: NONE
[15:42:09:222] [12885:12885] [INFO][com.freerdp.core.gcc] - Selected rdp encryption method: NONE
[15:42:09:240] [12885:12885] [WARN][com.freerdp.core.surface] - SURFACE_BITS_COMMAND->cmdType 0xc000 not allowed, correcting to 0x0006
Segmentation fault (core dumped)
I tried this on 3 different servers, same results are being observed. It is quite mysterious, hope you can reproduce it. I built weston from git and this issue still persists.
Note
It connects normally using wfreerdp.exe, no error triggered.