Date: Fri, 08 May 2015 06:34:19 +0200 From: Hans Petter Selasky <hps@selasky.org> To: Garrett Cooper <yaneurabeya@gmail.com>, Kevin Oberman <rkoberman@gmail.com> Cc: FreeBSD Current <freebsd-current@freebsd.org>, Ed Maste <emaste@freebsd.org>, Aleksandr Rybalko <ray@FreeBSD.org> Subject: Re: Race VT+X11 on -current Message-ID: <554C3CCB.3030809@selasky.org> In-Reply-To: <554BD2A8.70702@selasky.org> References: <554B5D11.3080709@selasky.org> <CAN6yY1vno%2B-nV9zBYp11A=F-vAURbhraEFyQR_ue4W7h8pQUMw@mail.gmail.com> <AA8B24D1-DF5A-42CD-8755-15EF3C46E760@gmail.com> <554BC475.50203@selasky.org> <554BD2A8.70702@selasky.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
Hi,
I have a fix, attached.
I'll just throw this in if nobody objects. Seems like a trivial issue:
Prevent switching to NULL or own window in the "vt_proc_window_switch"
function. This fixes an issue where X11 keyboard input can appear
stuck. The cause of the problem is a duplicate TTY device window
switch IOCTL during boot, which leaves the "vt_switch_timer" running,
because the current window is already selected. While at it factor out
some NULL checks.
PR: 200032
Reported by: multiple people
MFC after: 1 week
--HPS
[-- Attachment #2 --]
Index: vt_core.c
===================================================================
--- vt_core.c (revision 282504)
+++ vt_core.c (working copy)
@@ -451,9 +451,22 @@
struct vt_device *vd;
int ret;
+ /* Prevent switching to NULL */
+ if (vw == NULL) {
+ DPRINTF(30, "%s: Cannot switch to NULL.", __func__);
+ return (EINVAL);
+ }
vd = vw->vw_device;
curvw = vd->vd_curwindow;
+ /*
+ * Prevent switching to self to avoid starting the
+ * "vt_switch_timer()" again:
+ */
+ if (vw == curvw) {
+ DPRINTF(30, "%s: Cannot switch to self.", __func__);
+ return (0);
+ }
if (curvw->vw_flags & VWF_VTYLOCK)
return (EBUSY);
@@ -664,8 +677,7 @@
if (console == 0) {
if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) {
vw = vd->vd_windows[c - F_SCR];
- if (vw != NULL)
- vt_proc_window_switch(vw);
+ vt_proc_window_switch(vw);
return;
}
VT_LOCK(vd);
@@ -750,8 +762,7 @@
if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) {
vw = vd->vd_windows[c - F_SCR];
- if (vw != NULL)
- vt_proc_window_switch(vw);
+ vt_proc_window_switch(vw);
return (0);
}
@@ -760,15 +771,13 @@
/* Switch to next VT. */
c = (vw->vw_number + 1) % VT_MAXWINDOWS;
vw = vd->vd_windows[c];
- if (vw != NULL)
- vt_proc_window_switch(vw);
+ vt_proc_window_switch(vw);
return (0);
case PREV:
/* Switch to previous VT. */
c = (vw->vw_number - 1) % VT_MAXWINDOWS;
vw = vd->vd_windows[c];
- if (vw != NULL)
- vt_proc_window_switch(vw);
+ vt_proc_window_switch(vw);
return (0);
case SLK: {
vt_save_kbd_state(vw, kbd);
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?554C3CCB.3030809>
