[PATCH] fix console change race exposed by CFS



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/



Relevant Pages

  • Re: A Dual Engine Failure ? -- Chances are Astronomical..!
    ... software bug common to both systems perhaps, ... systems actually fail to switch or be correctly in sync..... ... electrical, dual electronics, etc. ...
    (uk.politics.misc)
  • Re: A Dual Engine Failure ? -- Chances are Astronomical..!
    ... systems actually fail to switch or be correctly in sync..... ... electrical, dual electronics, etc. ... The instruction from the cockpit went out ok, but it's transmission or action at the component level of engine control was changed which gave engine issues. ...
    (uk.politics.misc)
  • Re: Buying a house, Aluminum Wiring?
    ... all aluminum internal wiring. ... parts, the light switch to the ceiling lights doesn't work anymore, I ... While I've had no direct experience with Aluminum wiring but I've read ... fail over time or with repeated use.....if a new switch didn't deal with the ...
    (rec.woodworking)
  • Re: Cynaarq Jrrxraq Tnzvat
    ... Not the Bioshock demo - one play through was enough. ... to switch it off when it ended as it was. ... and fire before you fail (after a 20 sec cut scene). ...
    (uk.games.video.misc)
  • Re: Code density and performance?
    ... > On Thu, 28 Jul 2005, David Gay wrote: ... > Let's say we only have one CPU - one thread does an ll, we switch threads, ... > they are running on the same CPU. ... > Or will the second ll make the first sc fail? ...
    (comp.arch)