[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#995596: xorg-server: /dev/dri/card0 fd leak switching VTs, leads to lockup



Source: xorg-server
Version: 2:1.20.11-1
Severity: normal
Tags: patch
X-Debbugs-Cc: spikycaterpillar_debianbts@deekoo.net

Dear Maintainer,

The X server repeatedly opens /dev/dri/card0 on VT switch, but doesn't
close it. Eventually this leads to FD exhaustion and a wedged X server.

To replicate:
Login on a console
startx
start an xterm
lsof -n|grep -c /dev/dri/card0
control-alt-functionkey to change to another vt
control-alt-functionkey to change back to X
lsof -n|grep -c /dev/dri/card0


The patch I'm using at the moment:

### BEGIN PATCH ###
diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 13784d1..9f196ef 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -417,9 +417,10 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
         /* info->vt_active gets set by systemd_logind_vtenter() */
         info->active = TRUE;
 
-        if (pdev)
+        if (pdev) {
+            close(fd);
             pdev->flags &= ~XF86_PDEV_PAUSED;
-        else
+        } else
             systemd_logind_set_input_fd_for_all_devs(major, minor, fd,
                                                      info->vt_active);
### END PATCH ###

I do not know if the bug applies to the latest upstream version of X,
though the patch does apply.


-- System Information:
Debian Release: 11.0
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/4 CPU threads)
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled


Reply to: