public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: bobl <bobl@turbolinux.com>
To: linux-kernel@vger.kernel.org
Subject: Is this a bug of vt_ioctl ??
Date: Mon, 29 Nov 2004 15:40:59 +0800	[thread overview]
Message-ID: <41AAD28B.2070301@turbolinux.com> (raw)

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

             reply	other threads:[~2004-11-29  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-29  7:40 bobl [this message]
2004-11-29 21:26 ` Is this a bug of vt_ioctl ?? Andrew Morton
2004-11-30  1:26   ` bobl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41AAD28B.2070301@turbolinux.com \
    --to=bobl@turbolinux.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox