[PATCH] vcsa attribute bits -> ioctl(VT_GETHIFONTMASK)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

When reading /dev/vcsa while a font with more than 256 characters is
loaded, one of the attribute bits records the 9th bit of the character.
But depending on the console driver (vgacon or fbcon for instance),
that's bit 3 or bit 0.  And there is no way for userland to know that,
thus no way for userland to safely grab the screen content.  So here is
a (tested) patch.  I know 2.6.18 is very close now, but since this is a
quite trivial patch, maybe it could find its way in as soon as now?


  Add a VT_GETHIFONTMASK ioctl for knowing which bit is the 9th bit for
  VC text (vc_hi_font_mask field of the vc_data structure).

Signed-off-by: Samuel Thibault <[email protected]>

--- linux-2.6.17-orig/drivers/char/vt_ioctl.c	2006-03-20 06:53:29.000000000 +0100
+++ linux/drivers/char/vt_ioctl.c	2006-08-21 22:34:52.000000000 +0200
@@ -1012,6 +1012,8 @@
 		   return -EPERM;
 		vt_dont_switch = 0;
 		return 0;
+	case VT_GETHIFONTMASK:
+		return put_user(vc->vc_hi_font_mask, (unsigned short __user *)arg);
 	default:
 		return -ENOIOCTLCMD;
 	}
--- linux-2.6.17-orig/include/linux/vt.h	2006-03-20 06:53:29.000000000 +0100
+++ linux/include/linux/vt.h	2006-08-21 22:35:49.000000000 +0200
@@ -50,5 +50,6 @@
 #define VT_RESIZEX      0x560A  /* set kernel's idea of screensize + more */
 #define VT_LOCKSWITCH   0x560B  /* disallow vt switching */
 #define VT_UNLOCKSWITCH 0x560C  /* allow vt switching */
+#define VT_GETHIFONTMASK 0x560D  /* return hi font mask */
 
 #endif /* _LINUX_VT_H */
--- linux-2.6.17-orig/include/linux/compat_ioctl.h	2006-06-18 19:22:39.000000000 +0200
+++ linux/include/linux/compat_ioctl.h	2006-08-21 22:34:17.000000000 +0200
@@ -216,6 +216,7 @@
 COMPATIBLE_IOCTL(VT_RESIZEX)
 COMPATIBLE_IOCTL(VT_LOCKSWITCH)
 COMPATIBLE_IOCTL(VT_UNLOCKSWITCH)
+COMPATIBLE_IOCTL(VT_GETHIFONTMASK)
 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
 COMPATIBLE_IOCTL(RTC_AIE_ON)
 COMPATIBLE_IOCTL(RTC_AIE_OFF)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux