[PATCH] fix console change race exposed by CFS

From: Jan Luebbe
Date: Sat Sep 29 2007 - 13:39:24 EST


From: Jan L+APw-bbe +ADw-jluebbe+AEA-lasnet.de+AD4

The new behaviour of CFS exposes a race which occurs if a switch is
requested when vt+AF8-mode.mode is VT+AF8-PROCESS.

The process with vc-+AD4-vt+AF8-pid is signaled before vc-+AD4-vt+AF8-newvt is set. This
causes the switch to fail when triggered by the monitoing process
because the target is still -1.

Signed-off-by: Jan L+APw-bbe +ADw-jluebbe+AEA-lasnet.de+AD4
---
Index: linux-2.6.22/drivers/char/vt+AF8-ioctl.c
+AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0
--- linux-2.6.22.orig/drivers/char/vt+AF8-ioctl.c
+-+-+- linux-2.6.22/drivers/char/vt+AF8-ioctl.c
+AEAAQA -1208,15 +-1208,18 +AEAAQA
/+ACo
+ACo Send the signal as privileged - kill+AF8-pid() will
+ACo tell us if the process has gone or something else
- +ACo is awry
+- +ACo is awry.
+- +ACo
+- +ACo We need to set vt+AF8-newvt +ACo-before+ACo sending the signal or we
+- +ACo have a race.
+ACo-/
+- vc-+AD4-vt+AF8-newvt +AD0 new+AF8-vc-+AD4-vc+AF8-num+ADs
if (kill+AF8-pid(vc-+AD4-vt+AF8-pid, vc-+AD4-vt+AF8-mode.relsig, 1) +AD0APQ 0) +AHs
/+ACo
+ACo It worked. Mark the vt to switch to and
+ACo return. The process needs to send us a
+ACo VT+AF8-RELDISP ioctl to complete the switch.
+ACo-/
- vc-+AD4-vt+AF8-newvt +AD0 new+AF8-vc-+AD4-vc+AF8-num+ADs
return+ADs
+AH0


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/