FreeRDP / FreeRDP

FreeRDP is a free remote desktop protocol library and clients
http://www.freerdp.com/
Apache License 2.0
10.69k stars 14.7k forks source link

wlfreerdp segfaults #5211

Closed hendwolt closed 5 years ago

hendwolt commented 5 years ago

The Wayland client from the current master segfaults on Plasma5 on Wayland. Even without any parameters wlfreerdp segfaults.

operating system: openSUSE Tumbleweed

freerdp version and config: This is FreeRDP version 2.0.0-dev5 (281c85598) Build configuration: BUILD_TESTING=OFF BUILTIN_CHANNELS=OFF HAVE_AIO_H=1 HAVE_EXECINFO_H=1 HAVE_FCNTL_H=1 HAVE_INTTYPES_H=1 HAVE_JOURNALD_H=TRUE HAVE_MATH_C99_LONG_DOUBLE=1 HAVE_POLL_H=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK=ON HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL= HAVE_SYSLOG_H=1 HAVE_SYS_EVENTFD_H=1 HAVE_SYS_FILIO_H= HAVE_SYS_MODEM_H= HAVE_SYS_SELECT_H=1 HAVE_SYS_SOCKIO_H= HAVE_SYS_STRTIO_H= HAVE_SYS_TIMERFD_H=1 HAVE_TM_GMTOFF=1 HAVE_UNISTD_H=1 HAVE_XI_TOUCH_CLASS=1 WITH_ALSA=ON WITH_CCACHE=ON WITH_CHANNELS=ON WITH_CLIENT=ON WITH_CLIENT_AVAILABLE=1 WITH_CLIENT_CHANNELS=ON WITH_CLIENT_CHANNELS_AVAILABLE=1 WITH_CLIENT_COMMON=ON WITH_CLIENT_INTERFACE=OFF WITH_CUPS=ON WITH_DEBUG_ALL=OFF WITH_DEBUG_CAPABILITIES=OFF WITH_DEBUG_CERTIFICATE=OFF WITH_DEBUG_CHANNELS=OFF WITH_DEBUG_CLIPRDR=OFF WITH_DEBUG_DVC=OFF WITH_DEBUG_KBD=OFF WITH_DEBUG_LICENSE=OFF WITH_DEBUG_MUTEX=OFF WITH_DEBUG_NEGO=OFF WITH_DEBUG_NLA=OFF WITH_DEBUG_NTLM=OFF WITH_DEBUG_RAIL=OFF WITH_DEBUG_RDP=OFF WITH_DEBUG_RDPDR=OFF WITH_DEBUG_RDPEI=OFF WITH_DEBUG_REDIR=OFF WITH_DEBUG_RFX=OFF WITH_DEBUG_RINGBUFFER=OFF WITH_DEBUG_SCARD=OFF WITH_DEBUG_SND=OFF WITH_DEBUG_SVC=OFF WITH_DEBUG_SYMBOLS=OFF WITH_DEBUG_THREADS=OFF WITH_DEBUG_TIMEZONE=OFF WITH_DEBUG_TRANSPORT=OFF WITH_DEBUG_TSG=OFF WITH_DEBUG_TSMF=OFF WITH_DEBUG_WND=OFF WITH_DEBUG_X11=OFF WITH_DEBUG_X11_CLIPRDR=OFF WITH_DEBUG_X11_LOCAL_MOVESIZE=OFF WITH_DEBUG_XV=OFF WITH_DIRECTFB=OFF WITH_DSP_EXPERIMENTAL=OFF WITH_DSP_FFMPEG=ON WITH_EVENTFD_READ_WRITE=1 WITH_FAAC=OFF WITH_FAAD2=OFF WITH_FFMPEG=TRUE WITH_FFMPEG=TRUE WITH_GFX_H264=ON WITH_GPROF=OFF WITH_GSM=ON WITH_GSSAPI=OFF WITH_GSTREAMER_0_10=OFF WITH_GSTREAMER_1_0=ON WITH_ICU=ON WITH_IPP=OFF WITH_JPEG=ON WITH_KRB5=ON WITH_LAME=ON WITH_LIBRARY_VERSIONING=ON WITH_LIBSYSTEMD=ON WITH_MACAUDIO=OFF WITH_MACAUDIO=OFF WITH_MACAUDIO_AVAILABLE=0 WITH_MANPAGES=ON WITH_MBEDTLS=OFF WITH_OPENH264=OFF WITH_OPENSLES=OFF WITH_OPENSSL=ON WITH_OSS=OFF WITH_PAM=ON WITH_PCSC=ON WITH_PROFILER=OFF WITH_PULSE=ON WITH_SAMPLE=OFF WITH_SANITIZE_ADDRESS=OFF WITH_SANITIZE_ADDRESS_AVAILABLE=1 WITH_SANITIZE_MEMORY=OFF WITH_SANITIZE_MEMORY_AVAILABLE=1 WITH_SANITIZE_THREAD=OFF WITH_SANITIZE_THREAD_AVAILABLE=1 WITH_SERVER=ON WITH_SERVER_CHANNELS=ON WITH_SERVER_INTERFACE=ON WITH_SMARTCARD_INSPECT=ON WITH_SOXR=OFF WITH_SSE2=ON WITH_THIRD_PARTY=OFF WITH_VALGRIND_MEMCHECK=OFF WITH_VALGRIND_MEMCHECK_AVAILABLE=1 WITH_WAYLAND=ON WITH_X11=ON WITH_X264=OFF WITH_XCURSOR=ON WITH_XDAMAGE=ON WITH_XEXT=ON WITH_XFIXES=ON WITH_XI=ON WITH_XINERAMA=ON WITH_XKBFILE=ON WITH_XRANDR=ON WITH_XRENDER=ON WITH_XSHM=ON WITH_XTEST=ON WITH_XV=ON WITH_ZLIB=ON Build type: Release CFLAGS: -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIE -pie -fPIC -Wall -Wno-unused-result -Wno-unused-but-set-variable -Wno-deprecated-declarations -fvisibility=hidden -Wimplicit-function-declaration -Wredundant-decls -DWINPR_DLL Compiler: GNU, 8.2.1 Target architecture: x64

backtrace:

Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7e34274 in wl_proxy_marshal_constructor () from /usr/lib64/libwayland-client.so.0 (gdb) backtrace

0 0x00007ffff7e34274 in wl_proxy_marshal_constructor () from /usr/lib64/libwayland-client.so.0

1 0x00007ffff7f5aaaa in wl_data_device_manager_get_data_device (seat=, wl_data_device_manager=)

at /usr/include/wayland/wayland-client-protocol.h:2712

2 UwacSeatNew (d=d@entry=0x5555555c4b90, id=id@entry=6, version=version@entry=5)

at /usr/src/debug/freerdp-2.0.0~git20190123-1.1.x86_64/uwac/libuwac/uwac-input.c:810

3 0x00007ffff7f58c88 in registry_handle_global (data=0x5555555c4b90, registry=0x5555555c8e70, id=6, interface=, version=5)

at /usr/src/debug/freerdp-2.0.0~git20190123-1.1.x86_64/uwac/libuwac/uwac-display.c:186

4 0x00007ffff51526c5 in ?? () from /usr/lib64/libffi.so.7

5 0x00007ffff5151bd7 in ?? () from /usr/lib64/libffi.so.7

6 0x00007ffff7e3728d in ?? () from /usr/lib64/libwayland-client.so.0

7 0x00007ffff7e33ac9 in ?? () from /usr/lib64/libwayland-client.so.0

8 0x00007ffff7e34f94 in wl_display_dispatch_queue_pending () from /usr/lib64/libwayland-client.so.0

9 0x00007ffff7e353b3 in wl_display_roundtrip_queue () from /usr/lib64/libwayland-client.so.0

10 0x00007ffff7f58fcd in UwacOpenDisplay (name=0x0, err=0x7fffffffd884) at /usr/src/debug/freerdp-2.0.0~git20190123-1.1.x86_64/uwac/libuwac/uwac-display.c:417

11 0x0000555555557faf in wlf_client_new (context=0x555555590030, instance=)

at /usr/src/debug/freerdp-2.0.0~git20190123-1.1.x86_64/client/Wayland/wlfreerdp.c:459

12 wlf_client_new (instance=, context=0x555555590030) at /usr/src/debug/freerdp-2.0.0~git20190123-1.1.x86_64/client/Wayland/wlfreerdp.c:442

13 0x00007ffff7cdc108 in freerdp_context_new (instance=instance@entry=0x55555558fd50)

at /usr/src/debug/freerdp-2.0.0~git20190123-1.1.x86_64/libfreerdp/core/freerdp.c:728

14 0x00007ffff7f6e299 in freerdp_client_context_new (pEntryPoints=0x7fffffffd900)

at /usr/src/debug/freerdp-2.0.0~git20190123-1.1.x86_64/client/common/client.c:79

15 0x00005555555575a3 in main (argc=1, argv=0x7fffffffdcc8) at /usr/src/debug/freerdp-2.0.0~git20190123-1.1.x86_64/client/Wayland/wlfreerdp.c:520

akallabeth commented 5 years ago

@hendwolt Thank you for the report, could you check your wayland supports wl_data_device_manager interface? Might be a simple missing NULL check when accessing that.

hardening commented 5 years ago

@akallabeth might also be the announce of global object that aren't done in the order that we expect.

akallabeth commented 5 years ago

@hardening true.

hardening commented 5 years ago

@hendwolt can you give a try at https://github.com/hardening/FreeRDP/tree/ddm_fix ?

hardening commented 5 years ago

@hendwolt it has been merged upstream.

akallabeth commented 5 years ago

@hardening looks like we missed something else, added a patch in #5213

hendwolt commented 5 years ago

@akallabeth How can I find out if my wayland supports it? In the file wayland.xml on my system I find this snippet: interface name="wl_data_device" version="3" description summary="data transfer device" There is one wl_data_device per seat which can be obtained from the global wl_data_device_manager singleton. A wl_data_device provides access to inter-client data transfer mechanisms such as copy-and-paste and drag-and-drop. /description Is this enough?

akallabeth commented 5 years ago

@hendwolt yes, that is enough. Found the remaining issue and a fix is in #5213 along with some graphical glitch stuff.