Re: vt.c: unimap changes to (fg_?)console

H. Peter Anvin (hpa@zytor.com)
7 May 2001 06:45:52 -0700


Followup to: <20010507123709.D8052@garloff.suse.de>
By author: Kurt Garloff <garloff@suse.de>
In newsgroup: linux.dev.kernel
>
> Hi Linus, Alan, Andries,
>
> if you open /dev/tty4 and change the font via ioctl(KDFONTOP), it will be
> applied to the opened console, i.e. tty4. Then you set the corresponding
> unicodemap via PIO_UNIMAPCLR and PIO_UNIMAP ioctls. Those get applied to the
> current foreground console. Which is inconsistent.
>
> Looking at vt.c: vt_ioctl(), the situation is a bit messy: Some ioctls don't
> explicitly specify a tty (probably not needed, as some settings are global),
> some apply to fg_console, some apply to the opened console which is
> ((struct vt_struct*)tty->driver_data)->vc_num.
>

Okay, these should either be global or apply to the invoked (file
descriptor) tty. Anything else is completely broken. In fact, I'd
argue that using ioctl's for anything but global data (since it's
global, it has to be privileged) is in itself broken. (Note: all the
font stuff used to be global state for kernel memory reasons.)

Why do you have the following in your patch? It makes the permissions
on the console depend on whether or not it is in the foreground, which
seems like another stupid inconsistency:

> + if (!perm && fg_console !=3D console)
> + return -EPERM;
-hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/