lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 25 Mar 2009 12:51:44 -0400
From:	"D. Matt Placek" <dmattplacek@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] ioctl interface to wait on VT switch

This is a patch to the 2.6.29 kernel which adds an ioctl to the VT
interface which allows an application to wait on any VT switch, rather
than having to wait on switching to a specific VT.  This would be a
big help for the ConsoleKit, which currently creates 60+ threads where
each thread is asleep waiting for a switch to one of every possible
VT.  It would be great if we could get this included in the kernel- or
if there is a better approach feedback is invited.  It would simply be
nice not to have to spawn 60 threads just to wait for a console
switch, and this is a pretty minor addition to the VT system.


diff -U 3 -r linux-2.6.29-rc8/drivers/char/vt_ioctl.c
patched-linux-2.6.29-rc8/drivers/char/vt_ioctl.c
--- linux-2.6.29-rc8/drivers/char/vt_ioctl.c	2009-03-12 22:39:28.000000000 -0400
+++ patched-linux-2.6.29-rc8/drivers/char/vt_ioctl.c	2009-03-25
12:35:42.000000000 -0400
@@ -41,6 +41,8 @@
 #define VT_IS_IN_USE(i)	(console_driver->ttys[i] &&
console_driver->ttys[i]->count)
 #define VT_BUSY(i)	(VT_IS_IN_USE(i) || i == fg_console ||
vc_cons[i].d == sel_cons)

+#define WAIT_ANY_CONSOLE -1234
+
 /*
  * Console (vt and kd) routines, as defined by USL SVR4 manual, and by
  * experimentation and study of X386 SYSV handling.
@@ -846,6 +848,13 @@
 			ret = vt_waitactive(arg - 1);
 		break;

+
+	case VT_WAITSWITCH:
+		if (!perm)
+			goto eperm;
+      ret = vt_waitactive(WAIT_ANY_CONSOLE);
+		break;
+
 	/*
 	 * If a vt is under process control, the kernel will not switch to it
 	 * immediately, but postpone the operation until the process calls this
@@ -1202,6 +1211,11 @@
 		if (signal_pending(current))
 			break;
 		schedule();
+
+      if (vt == WAIT_ANY_CONSOLE) {
+         retval = 0;
+         break;
+      }
 	}
 	remove_wait_queue(&vt_activate_queue, &wait);
 	__set_current_state(TASK_RUNNING);
diff -U 3 -r linux-2.6.29-rc8/include/linux/vt.h
patched-linux-2.6.29-rc8/include/linux/vt.h
--- linux-2.6.29-rc8/include/linux/vt.h	2009-03-12 22:39:28.000000000 -0400
+++ patched-linux-2.6.29-rc8/include/linux/vt.h	2009-03-24
11:16:31.000000000 -0400
@@ -73,5 +73,6 @@
 #define VT_LOCKSWITCH   0x560B  /* disallow vt switching */
 #define VT_UNLOCKSWITCH 0x560C  /* allow vt switching */
 #define VT_GETHIFONTMASK 0x560D  /* return hi font mask */
+#define VT_WAITSWITCH    0x560E	/* wait for change in active vt */

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ