Fix a bug that will cause a process that calls the VT_WAITACTIVE ioctl

to become unkillable when that process is sent a termination signal.  The
process will sit in waitvt looping in the kernel, and chewing up all
available CPU until the system is rebooted.

Note: this is not an MFC as this code no longer exists in HEAD.  However,
this is based on the same syscons fix which was just MFC'd after one week
in HEAD.

Reviewed by:	bde
This commit is contained in:
marcus 2007-09-30 06:22:13 +00:00
parent 916a3cb56f
commit 67c6f3c74a

View File

@ -2590,26 +2590,20 @@ usl_vt_ioctl(struct cdev *dev, int cmd, caddr_t data, int flag, struct thread *t
/* sleep until vt switch happened */
i = *(int *)data - 1;
if(i != -1
&& (i < 0 || i >= PCVT_NSCREENS))
return EINVAL;
if(i != -1 && current_video_screen == i)
return 0;
if(i == -1)
i = minor(dev);
if(i < 0 || i >= PCVT_NSCREENS)
return EINVAL;
if(current_video_screen == i)
return 0;
{
int x = spltty();
error = 0;
while (current_video_screen != i &&
(error == 0 || error == ERESTART))
{
vs[i].vt_status |= VT_WAIT_ACT;
error = tsleep(&vs[i].smode,
PZERO | PCATCH, "waitvt", 0);
}
vs[i].vt_status |= VT_WAIT_ACT;
error = tsleep(&vs[i].smode,
PZERO | PCATCH, "waitvt", 0);
splx(x);
}
return error;