All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Linux/PPC Development <linuxppc-dev@ozlabs.org>,
	Linux Kernel Development <linux-kernel@vger.kernel.org>,
	Hiroaki Fuse <Hiroaki_Fuse@hq.scei.sony.co.jp>
Subject: Re: Too verbose compat_ioctl messages?
Date: Fri, 06 Jul 2007 09:30:43 -0700	[thread overview]
Message-ID: <468E6E33.3040000@zytor.com> (raw)
In-Reply-To: <Pine.LNX.4.62.0707061431360.1203@pademelon.sonytel.be>

Geert Uytterhoeven wrote:
> 
> Fuse-san discovered that running the umount that's part of busybox on a PS3
> with a recent kernel causes an error message to be printed on the console:
> 
> | ioctl32(busybox:1340): Unknown cmd fd(3) cmd(00004c01){t:'L';sz:0} arg(00000000) on /dev/sda1 
> 
> On older kernels (e.g. 2.6.16), this doesn't happen.
> 
> It can easily be reproduced by installing busybox and running
> 
> | busybox umount /mountpoint
> 
> on a mounted filesystem (except when using the loop device).
> 
> Apparently Busybox uses the LOOP_CLR_FD ioctl when unmounting a file system,
> which is supported by the loop device only.
> On other block device types, this ioctl is not supported:
>   - With a 64-bit application, the block layer returns ENOTTY (Inappropriate
>     ioctl for device), while the SCSI layer returns EINVAL (Invalid argument)
>   - With a 32-bit application, the compat_ioctl code returns EINVAL (Invalid
>     argument) and prints an error on the console (for the first 50
>     occurrencies, cfr. fs/compat_ioctl.c:compat_sys_ioctl())
> 
> As I understand, compat_ioctl_error() is used to inform the user about ioctl
> values that are not yet handled by the compat_ioctl layer. However, LOOP_CLR_FD
> doesn't need to be handled (no data to convert between 32-bit and 64-bit), and
> it's perfectly valid for a block device to not implement it.
> So it's confusing to print this error message.
> 
> Is there anything we can do about this?
> 

For one thing, it looks like we're returning the wrong thing (EINVAL
rather than ENOTTY) across the board.  This was unfortunately a common
misunderstanding with non-tty-related ioctls in the early days of Linux.

	-hpa

WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Linux Kernel Development <linux-kernel@vger.kernel.org>,
	Linux/PPC Development <linuxppc-dev@ozlabs.org>,
	Hiroaki Fuse <Hiroaki_Fuse@hq.scei.sony.co.jp>
Subject: Re: Too verbose compat_ioctl messages?
Date: Fri, 06 Jul 2007 09:30:43 -0700	[thread overview]
Message-ID: <468E6E33.3040000@zytor.com> (raw)
In-Reply-To: <Pine.LNX.4.62.0707061431360.1203@pademelon.sonytel.be>

Geert Uytterhoeven wrote:
> 
> Fuse-san discovered that running the umount that's part of busybox on a PS3
> with a recent kernel causes an error message to be printed on the console:
> 
> | ioctl32(busybox:1340): Unknown cmd fd(3) cmd(00004c01){t:'L';sz:0} arg(00000000) on /dev/sda1 
> 
> On older kernels (e.g. 2.6.16), this doesn't happen.
> 
> It can easily be reproduced by installing busybox and running
> 
> | busybox umount /mountpoint
> 
> on a mounted filesystem (except when using the loop device).
> 
> Apparently Busybox uses the LOOP_CLR_FD ioctl when unmounting a file system,
> which is supported by the loop device only.
> On other block device types, this ioctl is not supported:
>   - With a 64-bit application, the block layer returns ENOTTY (Inappropriate
>     ioctl for device), while the SCSI layer returns EINVAL (Invalid argument)
>   - With a 32-bit application, the compat_ioctl code returns EINVAL (Invalid
>     argument) and prints an error on the console (for the first 50
>     occurrencies, cfr. fs/compat_ioctl.c:compat_sys_ioctl())
> 
> As I understand, compat_ioctl_error() is used to inform the user about ioctl
> values that are not yet handled by the compat_ioctl layer. However, LOOP_CLR_FD
> doesn't need to be handled (no data to convert between 32-bit and 64-bit), and
> it's perfectly valid for a block device to not implement it.
> So it's confusing to print this error message.
> 
> Is there anything we can do about this?
> 

For one thing, it looks like we're returning the wrong thing (EINVAL
rather than ENOTTY) across the board.  This was unfortunately a common
misunderstanding with non-tty-related ioctls in the early days of Linux.

	-hpa

  parent reply	other threads:[~2007-07-06 17:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-06 12:47 Too verbose compat_ioctl messages? Geert Uytterhoeven
2007-07-06 12:57 ` Andreas Schwab
2007-07-06 12:57   ` Andreas Schwab
2007-07-06 15:49   ` Geert Uytterhoeven
2007-07-06 15:49     ` Geert Uytterhoeven
2007-07-06 15:52   ` [PATCH] compat32: ignore the LOOP_CLR_FD ioctl Geert Uytterhoeven
2007-07-06 15:52     ` Geert Uytterhoeven
2007-07-06 16:30 ` H. Peter Anvin [this message]
2007-07-06 16:30   ` Too verbose compat_ioctl messages? H. Peter Anvin
2007-07-06 18:14   ` Andi Kleen
2007-07-06 18:14     ` Andi Kleen
2007-07-06 17:48     ` H. Peter Anvin
2007-07-06 17:48       ` H. Peter Anvin
2007-07-06 18:33     ` Jeremy Fitzhardinge
2007-07-06 18:33       ` Jeremy Fitzhardinge
2007-07-06 18:36       ` H. Peter Anvin
2007-07-06 18:36         ` H. Peter Anvin
2007-07-06 18:40         ` Jeremy Fitzhardinge
2007-07-06 18:40           ` Jeremy Fitzhardinge
2007-07-06 19:04       ` Andi Kleen
2007-07-06 19:04         ` Andi Kleen

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=468E6E33.3040000@zytor.com \
    --to=hpa@zytor.com \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=Hiroaki_Fuse@hq.scei.sony.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.