Skip to contentSkip to conversation

Fix KDFONTOP 32bit compatibility layer

PATCH In review Samuel Thibault 3 participants 3 messages Jan 28, 2012 – Jan 31, 2012 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix KDFONTOP 32bit compatibility layer

KDFONTOP(GET) currently fails with EIO when being run in a 32bit userland with a 64bit kernel if the font width is not 8. This is because the compatibility layer introduced by e9216651 forces the addition of the KD_FONT_FLAG_OLD flag, which makes con_font_get return EIO in such case. This flag should *not* be set for KDFONTOP, since it's actually the whole point of this flag (see comment in con_font_set for instance).

drivers/tty/vt/vt_ioctl.c +0 -1
index 5e096f4..65447c5 100644
@@ -1463,7 +1463,6 @@ compat_kdfontop_ioctl(struct compat_console_font_op __user *fontop,
 	if (!perm && op->op != KD_FONT_OP_GET)
 		return -EPERM;
 	op->data = compat_ptr(((struct compat_console_font_op *)op)->data);
-	op->flags |= KD_FONT_FLAG_OLD;
 	i = con_font_op(vc, op);
 	if (i)
 		return i;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Samuel Thibault

KDFONTOP(GET) currently fails with EIO when being run in a 32bit userland with a 64bit kernel if the font width is not 8. This is because the compatibility layer introduced by e9216651 forces the addition of the KD_FONT_FLAG_OLD flag, which makes con_font_get return EIO in such case. This flag should not be set for KDFONTOP, since it's actually the whole point of this flag (see comment in con_font_set for instance).

Hmm, this flag was not introduced in the patch you cite, it used to live in fs/compat_ioctl.c before that, since before the start of the git history. It seems to date back on the original sparc64 implementation of do_kdfontop_ioctl that was written by Eddie Dost in 1998.

Quoted 13 lines
drivers/tty/vt/vt_ioctl.c +0 -1
index 5e096f4..65447c5 100644
@@ -1463,7 +1463,6 @@ compat_kdfontop_ioctl(struct compat_console_font_op __user *fontop,
        if (!perm && op->op != KD_FONT_OP_GET)
                return -EPERM;
        op->data = compat_ptr(((struct compat_console_font_op *)op)->data);
-       op->flags |= KD_FONT_FLAG_OLD;
        i = con_font_op(vc, op);
        if (i)
                return i;
Quoted 1 line

From all I can tell, the patch looks correct, but please update the

description so you don't blame my innocent patch ;-)

#2 lore raw
Quoted 31 lines · On Tue, 31 Jan 2012 16:35:36 +0000 Arnd Bergmann <[email protected]> wrote:
Quoted 8 lines · Samuel Thibault

KDFONTOP(GET) currently fails with EIO when being run in a 32bit userland with a 64bit kernel if the font width is not 8. This is because the compatibility layer introduced by e9216651 forces the addition of the KD_FONT_FLAG_OLD flag, which makes con_font_get return EIO in such case. This flag should not be set for KDFONTOP, since it's actually the whole point of this flag (see comment in con_font_set for instance).

Hmm, this flag was not introduced in the patch you cite, it used to live in fs/compat_ioctl.c before that, since before the start of the git history. It seems to date back on the original sparc64 implementation of do_kdfontop_ioctl that was written by Eddie Dost in 1998.

drivers/tty/vt/vt_ioctl.c compat_kdfontop_ioctl(struct compat_console_font_op __user *fontop, · line 1468

Quoted 12 lines
drivers/tty/vt/vt_ioctl.c +0 -1
index 5e096f4..65447c5 100644
@@ -1463,7 +1463,6 @@ compat_kdfontop_ioctl(struct compat_console_font_op __user *fontop,
        if (!perm && op->op != KD_FONT_OP_GET)
                return -EPERM;
        op->data = compat_ptr(((struct compat_console_font_op *)op)->data);
-       op->flags |= KD_FONT_FLAG_OLD;
        i = con_font_op(vc, op);
        if (i)
                return i;

From all I can tell, the patch looks correct, but please update the description so you don't blame my innocent patch ;-)

Quoted 1 line

Yes, we should note the fact that at least one kernel bug isn't your fault ;)

I changed the changelog to

: KDFONTOP(GET) currently fails with EIO when being run in a 32bit userland : with a 64bit kernel if the font width is not 8.
:
: This is because of the setting of the KD_FONT_FLAG_OLD flag, which makes : con_font_get return EIO in such case.
:
: This flag should *not* be set for KDFONTOP, since it's actually the whole : point of this flag (see comment in con_font_set for instance). :
: Signed-off-by: Samuel Thibault <[email protected]> : Reviewed-by: Arnd Bergmann <[email protected]>
: Cc: Greg Kroah-Hartman <[email protected]>
: Cc: Arthur Taylor <[email protected]>
: Cc: Jiri Slaby <[email protected]>
: Cc: Jiri Olsa <[email protected]>
: Cc: <[email protected]>