evdi icon indicating copy to clipboard operation
evdi copied to clipboard

evdi crashes DisplayLinkManager when moving mouse to connected display

Open winterwurzel opened this issue 2 years ago • 3 comments

  • Are you using the latest driver? using the latest fedora 39 release from: https://github.com/displaylink-rpm/displaylink-rpm/releases/download/v5.8.0-1/fedora-39-displaylink-1.14.1-2.x86_64.rpm
  • Are you using the latest EVDI version? Yes, evdi-1.14.1
  • If you are using a DisplayLink device, have you checked 'troubleshooting' on DisplayLink's website? Yes
  • Is this issue related to evdi/kernel? Yes, from what I understand in the stacktrace
  • Linux distribution and its version: Fedora 39
  • Linux kernel version: Linux V 6.6.8-200.fsync.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC TKG Fri Dec 29 23:43:56 UTC 2023 x86_64 GNU/Linux
  • Xorg version (if used): Wayland
  • Desktop environment in use: KDE Plasma Version 5.27.10

Description

As soon as I move the mouse cursor to a monitor connected via displaylink it crashes. Moving any type and number of windows on the screen (via keyboard shortcuts) works flawlessly.

Syslog stacktrace can be found further below.

Logs

  • syslog stacktrace: https://pastebin.com/4m2WjkgU
  • /var/lib/dkms/evdi/kernel-[version]/log/make.log: https://pastebin.com/4cqRU3C1
  • /var/log/displaylink/displaylink.log:
Creating symlink /var/lib/dkms/evdi/1.14.1/source -> /usr/src/evdi-1.14.1
Sign command: /lib/modules/6.6.8-200.fsync.fc39.x86_64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
make -j24 KERNELRELEASE=6.6.8-200.fsync.fc39.x86_64 all INCLUDEDIR=/lib/modules/6.6.8-200.fsync.fc39.x86_64/build/include KVERSION=6.6.8-200.fsync.fc39.x86_64 DKMS_BUILD=1...
Signing module /var/lib/dkms/evdi/1.14.1/build/evdi.ko
Cleaning build area...

evdi.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.6.8-200.fsync.fc39.x86_64/extra/
depmod....

winterwurzel avatar Jan 07 '24 11:01 winterwurzel

I have the same issue.

Linux distribution and its version: Ubuntu 23.10 Linux kernel version: Linux 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux Xorg version (if used): Wayland Desktop environment in use: KDE Plasma Version 5.27 Pc: Lenovo thinkpad T14 Gen3 (AMD) Docking Station: Lenovo ThinkPad Hybrid USB_C with USB-A Dock

After a lot of crashes from driver, the issue will suddenly disappear and moving the cursor works just fine. The issue comes back after reconnecting or restarting my laptop.

DLSupportTool logs: https://displaylink.org/forum/showthread.php?t=69120

MariusLer avatar Jan 19 '24 13:01 MariusLer

Hello,

New user of a display link dock, I face the exact same issue.

Screens are working fine (Moving glxgears using keyboard on all of them).

Did you find a workaround?

qdel avatar Feb 03 '24 15:02 qdel

UPDATE: It is not a bug from displaylink, it was caused by the memcpy in the following code:

https://github.com/DisplayLink/evdi/blob/9905b9bfed8b7e49befa0530bfb6e464380d938f/library/evdi_lib.c#L850-L879

Currently, I found the event->buffer_length were set to 16384 (128×128 pixels) bytes, but we can only copy 4096 (64×64 pixels) bytes from mmap before it raises SIGBUS signal.

Extra debugging will be required to determine the where the bug originated from.


Here's the relevant part of the stack trace:

DisplayLinkManager v5.8.0 (6.3.33.0)
#0  0x00007f0fca175587 n/a (libc.so.6 + 0x15b587)
#1  0x00007f0fca49101a evdi_handle_events (libevdi.so + 0x401a)
#2  0x000055c813588bee n/a (DisplayLinkManager + 0x244bee)
#3  0x000055c813465fc4 n/a (DisplayLinkManager + 0x121fc4)
#4  0x000055c8134e3c60 n/a (DisplayLinkManager + 0x19fc60)
#5  0x00007f0fca0a955a n/a (libc.so.6 + 0x8f55a)
#6  0x00007f0fca126a3c n/a (libc.so.6 + 0x10ca3c)

The issue appears to stem from this part of the code:

https://github.com/DisplayLink/evdi/blob/9905b9bfed8b7e49befa0530bfb6e464380d938f/library/evdi_lib.c#L949-L961


UPDATE: Here's an improved patch to work around the issue.

If you're encountering this problem, there's a workaround that can prevent the program from crashing:

 	if (event->enabled) { 
 		size_t size = event->buffer_length; 
+		size = size > 0x1000 ? 0x1000 : size; // limit the max read size to 64*64=4096 pixels
 		uint64_t offset = 
 			evdi_get_dumb_offset(handle, event->buffer_handle); 
 		void *ptr = mmap(0, size, PROT_READ, 
 				 MAP_SHARED, handle->fd, offset); 
  
 		if (ptr != MAP_FAILED) { 
 			cursor_set.buffer = malloc(size); 
 			memcpy(cursor_set.buffer, ptr, size); 
 			munmap(ptr, size); 
 		} else { 
 			evdi_log("Error: mmap failed with error: %s", strerror(errno)); 
 		} 
 	} 

With this workaround, the mouse cursor may only display partially on the screen (but at least it won't crash). You can try adjusting the cursor size in the KDE appearance configuration, which might make the cursor fully visible.

mnixry avatar Feb 25 '24 12:02 mnixry

Same issue over here using a DELL D6000 Dock. The workaround, setting the env variable KWIN_DRM_NO_AMS=1, mentioned in https://github.com/DisplayLink/evdi/issues/459#issuecomment-1980882934 fixed the crashes of displaylink.service.

dclasen-qd avatar Mar 14 '24 07:03 dclasen-qd

Same issue over here using a DELL D6000 Dock. The workaround, setting the env variable KWIN_DRM_NO_AMS=1, mentioned in #459 (comment) fixed the crashes of displaylink.service.

workaround works, thanks

winterwurzel avatar Mar 14 '24 16:03 winterwurzel

Fixed in 1.14.3

displaylink-emajewsk avatar Apr 10 '24 08:04 displaylink-emajewsk