linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is this a bug of vt_ioctl ??
@ 2004-11-29  7:40 bobl
  2004-11-29 21:26 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: bobl @ 2004-11-29  7:40 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1807 bytes --]

Hi,All:

     I think this is a bug of vt_ioctl, who can give me a confirm?

     In the man page of consolechars(v 0.3.3), we can see the describe 
as follow:

---------------------------------------------------------------------
        --tty=device
               Use  device as console device for ioctls, instead of 
guessing which one to use, which usually chooses the current
               tty.  This can be useful for testing when under X, in 
conjunction with --no-act - actual ioctls are  refused  for
               some reason then.

--------------------------------------------------------------------

But when i use the command as follow,:
consolechars --sfm=/dir/name --tty=/dev/tty5  under tty1. The change 
happen on tty1, not on tty5! So i read the source code of consolechars 
and find the command as above use ioctl cmd PIO_UNIMAPCLR and 
PIO_UNIMAP. The source code of kernel 2.6.8.1 as follow:
(drivers/char/vt_ioctl.c)

         ...
         case PIO_UNIMAPCLR:
               { struct unimapinit ui;
                 if (!perm)
                         return -EPERM;
                 i = copy_from_user(&ui, (void *)arg, sizeof(struct 
unimapinit));
                 if (i) return -EFAULT;
                 con_clear_unimap(fg_console, &ui);
                 return 0;
               }

         case PIO_UNIMAP:
         case GIO_UNIMAP:
                 return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, 
perm);
         ...


we can see in the case PIO_UNIMAPCLR, One parameter of con_clear_unimp 
is  "fg_console"! it's current tty!  In the implement of 
do_unimap_ioctl(), use "fg_console" too! Use "console" will be right!


The attachment is a patch against 2.6.8.1. If what i said is right, 
there also should do some other modify, such as in the case of 
GIO_SCRNMAP!

[-- Attachment #2: vt_ioctl_2.6.8.1.patch --]
[-- Type: text/plain, Size: 1236 bytes --]

--- linux/drivers/char/vt_ioctl.c.orig	2004-11-29 15:36:28.100257232 +0800
+++ linux/drivers/char/vt_ioctl.c	2004-11-29 15:36:10.772891392 +0800
@@ -332,7 +332,7 @@
 }
 
 static inline int 
-do_unimap_ioctl(int cmd, struct unimapdesc *user_ud,int perm)
+do_unimap_ioctl(int cmd, int con, struct unimapdesc *user_ud,int perm)
 {
 	struct unimapdesc tmp;
 	int i = 0; 
@@ -348,9 +348,9 @@
 	case PIO_UNIMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_unimap(fg_console, tmp.entry_ct, tmp.entries);
+		return con_set_unimap(con, tmp.entry_ct, tmp.entries);
 	case GIO_UNIMAP:
-		return con_get_unimap(fg_console, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries);
+		return con_get_unimap(con, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries);
 	}
 	return 0;
 }
@@ -966,13 +966,13 @@
 			return -EPERM;
 		i = copy_from_user(&ui, (void *)arg, sizeof(struct unimapinit));
 		if (i) return -EFAULT;
-		con_clear_unimap(fg_console, &ui);
+		con_clear_unimap(console, &ui);
 		return 0;
 	      }
 
 	case PIO_UNIMAP:
 	case GIO_UNIMAP:
-		return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, perm);
+		return do_unimap_ioctl(cmd, console, (struct unimapdesc *)arg, perm);
 
 	case VT_LOCKSWITCH:
 		if (!capable(CAP_SYS_TTY_CONFIG))

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

* Re: Is this a bug of vt_ioctl ??
  2004-11-29  7:40 Is this a bug of vt_ioctl ?? bobl
@ 2004-11-29 21:26 ` Andrew Morton
  2004-11-30  1:26   ` bobl
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2004-11-29 21:26 UTC (permalink / raw)
  To: bobl; +Cc: linux-kernel

bobl <bobl@turbolinux.com> wrote:
>
> we can see in the case PIO_UNIMAPCLR, One parameter of con_clear_unimp 
> is  "fg_console"! it's current tty!  In the implement of 
> do_unimap_ioctl(), use "fg_console" too! Use "console" will be right!

This was fixed almost a year ago.

> 
> The attachment is a patch against 2.6.8.1.

Maybe you're looking at a 2.4 kernel.

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

* Re: Is this a bug of vt_ioctl ??
  2004-11-29 21:26 ` Andrew Morton
@ 2004-11-30  1:26   ` bobl
  0 siblings, 0 replies; 3+ messages in thread
From: bobl @ 2004-11-30  1:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Andrew Morton wrote:
> bobl <bobl@turbolinux.com> wrote:
> 
>>we can see in the case PIO_UNIMAPCLR, One parameter of con_clear_unimp 
>>is  "fg_console"! it's current tty!  In the implement of 
>>do_unimap_ioctl(), use "fg_console" too! Use "console" will be right!
> 
> 
> This was fixed almost a year ago.
> 
> 
>>The attachment is a patch against 2.6.8.1.
> 
> 
> Maybe you're looking at a 2.4 kernel.
> 
Sorry!

It's my fault! What i am looking is 2.6.0!

So sorry!

Bob


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

end of thread, other threads:[~2004-11-30  1:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-29  7:40 Is this a bug of vt_ioctl ?? bobl
2004-11-29 21:26 ` Andrew Morton
2004-11-30  1:26   ` bobl

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).