Bug#702705: [vlock] This are a race

2013-10-18 Thread Rodolfo García Peñas (kix)


Hi,

could you help us with this problem?

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702705#72

Thanks.
kix
--
 .''`.
: :'  : Rodolfo García Peñas (kix) k...@debian.org
`. `'`  Proud Debian Developer
 `-


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#702705: [vlock] This are a race

2013-09-18 Thread Bastien ROUCARIÈS
Package: vlock
Version: 2.2.2-3
control: tag -1 + patch

Ok may be a kernel problem search
Race in vt_event_wait() during suspend/resume

Nevertheless they are other problem with vlock:
- VT_WAITACTIVATE has select semantic ie 
accroding to xfree86/os-support/linux/lnx_init.
  There's a race here, in that if someone else does a VT_ACTIVATE
  between our ACTIVATE/WAITACTIVE, we might never get the VT. 
  So, just spin until we do.  There's really no fixing this,
  it's a racy protocol.

May be time to get kernel support ?


Bastien
-- 
Dr-Ing Bastien ROUCARIÈS Université de Cergy/SATIE ENS Cachan--- new.c.old	2008-05-18 11:10:54.0 +0200
+++ new.c	2013-09-18 13:46:53.961467522 +0200
@@ -103,9 +103,23 @@
  * file descriptor. */
 static int activate_console(int consfd, int vtno)
 {
-  int c = ioctl(consfd, VT_ACTIVATE, vtno);
+  int c;
 
-  return c  0 ? c : ioctl(consfd, VT_WAITACTIVE, vtno);
+  c = ioctl(consfd, VT_ACTIVATE, vtno);
+  if (c  0)
+goto error;
+
+  do {
+/* this ioctl has select behavior */
+c = ioctl(consfd, VT_WAITACTIVE, vtno);
+  } while (c  0  errno == EINTR);
+
+  if (c  0)
+goto error;
+  
+  return c;
+ error:
+  return c;
 }
 
 struct new_console_context {