linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] TTY: Wrong unicode value copied in con_set_unimap()
@ 2012-03-15 17:33 Liz Clark
  2012-03-15 18:03 ` Greg KH
  2012-03-15 18:55 ` Greg KH
  0 siblings, 2 replies; 7+ messages in thread
From: Liz Clark @ 2012-03-15 17:33 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Liz Clark

Bugzilla 40012: PIO_UNIMAP bug: error updating Unicode-to-font map

The unicode font map for the virtual console is a 32x32x64 table which
allocates rows dynamically as entries are added.  The unicode value
increases sequentially and should count all entries even in empty
rows.  The defect is when copying the unicode font map in con_set_unimap(),
the unicode value is not incremented properly.  The wrong unicode value
is entered in the new font map.

Signed-off-by: Liz Clark <liz.clark@hp.com>
---
 drivers/tty/vt/consolemap.c |   51 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index a0f3d6c..8308fc7 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -516,6 +516,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
 	int err = 0, err1, i;
 	struct uni_pagedir *p, *q;
 
+	/* Save original vc_unipagdir_loc in case we allocate a new one */
 	p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 	if (p->readonly) return -EIO;
 	
@@ -528,26 +529,57 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
 		err1 = con_clear_unimap(vc, NULL);
 		if (err1) return err1;
 		
+		/*
+		 * Since refcount was > 1, con_clear_unimap() allocated a
+		 * a new uni_pagedir for this vc.  Re: p != q
+		 */
 		q = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
-		for (i = 0, l = 0; i < 32; i++)
+
+		/*
+		 * uni_pgdir is a 32*32*64 table with rows allocated
+		 * when its first entry is added.  The unicode value must
+		 * still be incremented for empty rows.  We are copying
+		 * entries from "p" (old) to "q" (new).
+		 */
+		l = 0;		/* unicode value */
+		for (i = 0; i < 32; i++)
 		if ((p1 = p->uni_pgdir[i]))
 			for (j = 0; j < 32; j++)
-			if ((p2 = p1[j]))
+			if ((p2 = p1[j])) {
 				for (k = 0; k < 64; k++, l++)
 				if (p2[k] != 0xffff) {
+					/*
+					 * Found one, copy entry for unicode
+					 * l with fontpos value p2[k].
+					 */
 					err1 = con_insert_unipair(q, l, p2[k]);
 					if (err1) {
 						p->refcount++;
 						*vc->vc_uni_pagedir_loc = (unsigned long)p;
 						con_release_unimap(q);
 						kfree(q);
-						return err1; 
+						return err1;
 					}
-              			}
-              	p = q;
-	} else if (p == dflt)
+				}
+			} else {
+				/* Account for row of 64 empty entries */
+				l += 64;
+			}
+		else
+			/* Account for empty table */
+			l += 32 * 64;
+
+		/*
+		 * Finished copying font table, set vc_uni_pagedir to new table
+		 */
+		p = q;
+	} else if (p == dflt) {
 		dflt = NULL;
-	
+	}
+
+	/*
+	 * Insert user specified unicode pairs into new table.
+	 */
 	while (ct--) {
 		unsigned short unicode, fontpos;
 		__get_user(unicode, &list->unicode);
@@ -557,11 +589,14 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
 		list++;
 	}
 	
+	/*
+	 * Merge with fontmaps of any other virtual consoles.
+	 */
 	if (con_unify_unimap(vc, p))
 		return err;
 
 	for (i = 0; i <= 3; i++)
-		set_inverse_transl(vc, p, i); /* Update all inverse translations */
+		set_inverse_transl(vc, p, i); /* Update inverse translations */
 	set_inverse_trans_unicode(vc, p);
   
 	return err;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] TTY: Wrong unicode value copied in con_set_unimap()
  2012-03-15 17:33 [PATCH] TTY: Wrong unicode value copied in con_set_unimap() Liz Clark
@ 2012-03-15 18:03 ` Greg KH
  2012-03-15 18:06   ` Clark, Liz
  2012-03-15 18:09   ` Don Morris
  2012-03-15 18:55 ` Greg KH
  1 sibling, 2 replies; 7+ messages in thread
From: Greg KH @ 2012-03-15 18:03 UTC (permalink / raw)
  To: Liz Clark; +Cc: linux-kernel

On Thu, Mar 15, 2012 at 10:33:29AM -0700, Liz Clark wrote:
> Bugzilla 40012: PIO_UNIMAP bug: error updating Unicode-to-font map

What bugzilla are you referring to here?  bugs.gentoo.org?  :)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] TTY: Wrong unicode value copied in con_set_unimap()
  2012-03-15 18:03 ` Greg KH
@ 2012-03-15 18:06   ` Clark, Liz
  2012-03-15 18:09   ` Don Morris
  1 sibling, 0 replies; 7+ messages in thread
From: Clark, Liz @ 2012-03-15 18:06 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 674 bytes --]


> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Thursday, March 15, 2012 11:03 AM
> To: Clark, Liz
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] TTY: Wrong unicode value copied in
> con_set_unimap()
> 
> On Thu, Mar 15, 2012 at 10:33:29AM -0700, Liz Clark wrote:
> > Bugzilla 40012: PIO_UNIMAP bug: error updating Unicode-to-font map
> 
> What bugzilla are you referring to here?  bugs.gentoo.org?  :)


https://bugzilla.kernel.org/show_bug.cgi?id=40012


Liz
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] TTY: Wrong unicode value copied in con_set_unimap()
  2012-03-15 18:03 ` Greg KH
  2012-03-15 18:06   ` Clark, Liz
@ 2012-03-15 18:09   ` Don Morris
  1 sibling, 0 replies; 7+ messages in thread
From: Don Morris @ 2012-03-15 18:09 UTC (permalink / raw)
  To: Greg KH; +Cc: Liz Clark, linux-kernel

On 03/15/2012 11:03 AM, Greg KH wrote:
> On Thu, Mar 15, 2012 at 10:33:29AM -0700, Liz Clark wrote:
>> Bugzilla 40012: PIO_UNIMAP bug: error updating Unicode-to-font map
> 
> What bugzilla are you referring to here?  bugs.gentoo.org?  :)
> 

https://bugzilla.kernel.org/show_bug.cgi?id=40012

Don Morris


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] TTY: Wrong unicode value copied in con_set_unimap()
  2012-03-15 17:33 [PATCH] TTY: Wrong unicode value copied in con_set_unimap() Liz Clark
  2012-03-15 18:03 ` Greg KH
@ 2012-03-15 18:55 ` Greg KH
  2012-03-15 19:36   ` Clark, Liz
  1 sibling, 1 reply; 7+ messages in thread
From: Greg KH @ 2012-03-15 18:55 UTC (permalink / raw)
  To: Liz Clark; +Cc: linux-kernel

On Thu, Mar 15, 2012 at 10:33:29AM -0700, Liz Clark wrote:
> Bugzilla 40012: PIO_UNIMAP bug: error updating Unicode-to-font map
> 
> The unicode font map for the virtual console is a 32x32x64 table which
> allocates rows dynamically as entries are added.  The unicode value
> increases sequentially and should count all entries even in empty
> rows.  The defect is when copying the unicode font map in con_set_unimap(),
> the unicode value is not incremented properly.  The wrong unicode value
> is entered in the new font map.
> 
> Signed-off-by: Liz Clark <liz.clark@hp.com>

Is this a new problem caused by recent changes in this area, or has it
always been there and needs to be backported to older kernels to solve
the problem there?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] TTY: Wrong unicode value copied in con_set_unimap()
  2012-03-15 18:55 ` Greg KH
@ 2012-03-15 19:36   ` Clark, Liz
  2012-03-15 19:48     ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Clark, Liz @ 2012-03-15 19:36 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Thursday, March 15, 2012 11:55 AM
> To: Clark, Liz
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] TTY: Wrong unicode value copied in
> con_set_unimap()
> 
> On Thu, Mar 15, 2012 at 10:33:29AM -0700, Liz Clark wrote:
> > Bugzilla 40012: PIO_UNIMAP bug: error updating Unicode-to-font map
> >
> > The unicode font map for the virtual console is a 32x32x64 table
> which
> > allocates rows dynamically as entries are added.  The unicode value
> > increases sequentially and should count all entries even in empty
> > rows.  The defect is when copying the unicode font map in
> con_set_unimap(),
> > the unicode value is not incremented properly.  The wrong unicode
> value
> > is entered in the new font map.
> >
> > Signed-off-by: Liz Clark <liz.clark@hp.com>
> 
> Is this a new problem caused by recent changes in this area, or has it
> always been there and needs to be backported to older kernels to solve
> the problem there?
> 
> thanks,
> 
> greg k-h


The code with the defect was introduced in v2.1.112.  Prior to that the fontmap was not copied at all in con_set_unimap().


Liz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] TTY: Wrong unicode value copied in con_set_unimap()
  2012-03-15 19:36   ` Clark, Liz
@ 2012-03-15 19:48     ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2012-03-15 19:48 UTC (permalink / raw)
  To: Clark, Liz; +Cc: linux-kernel

On Thu, Mar 15, 2012 at 07:36:34PM +0000, Clark, Liz wrote:
> > -----Original Message-----
> > From: Greg KH [mailto:gregkh@linuxfoundation.org]
> > Sent: Thursday, March 15, 2012 11:55 AM
> > To: Clark, Liz
> > Cc: linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH] TTY: Wrong unicode value copied in
> > con_set_unimap()
> > 
> > On Thu, Mar 15, 2012 at 10:33:29AM -0700, Liz Clark wrote:
> > > Bugzilla 40012: PIO_UNIMAP bug: error updating Unicode-to-font map
> > >
> > > The unicode font map for the virtual console is a 32x32x64 table
> > which
> > > allocates rows dynamically as entries are added.  The unicode value
> > > increases sequentially and should count all entries even in empty
> > > rows.  The defect is when copying the unicode font map in
> > con_set_unimap(),
> > > the unicode value is not incremented properly.  The wrong unicode
> > value
> > > is entered in the new font map.
> > >
> > > Signed-off-by: Liz Clark <liz.clark@hp.com>
> > 
> > Is this a new problem caused by recent changes in this area, or has it
> > always been there and needs to be backported to older kernels to solve
> > the problem there?
> > 
> > thanks,
> > 
> > greg k-h
> 
> 
> The code with the defect was introduced in v2.1.112.  Prior to that
> the fontmap was not copied at all in con_set_unimap().

Ok, as this has been with us for a few years, it can wait for 3.4 to go
in, and I'll mark it for stable to get it applied backwards as far as it
can go.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-15 19:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-15 17:33 [PATCH] TTY: Wrong unicode value copied in con_set_unimap() Liz Clark
2012-03-15 18:03 ` Greg KH
2012-03-15 18:06   ` Clark, Liz
2012-03-15 18:09   ` Don Morris
2012-03-15 18:55 ` Greg KH
2012-03-15 19:36   ` Clark, Liz
2012-03-15 19:48     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).