Too verbose compat_ioctl messages?

8 messages, 4 authors, 2007-07-06 · open the first message on its own page

Too verbose compat_ioctl messages?

From: Geert Uytterhoeven <hidden>
Date: 2007-07-06 12:48:17

	Hi,

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?

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   Geert.Uytterhoeven@sonycom.com	
Internet: http://www.sony-europe.com/
 	
Sony Network and Software Technology Center Europe	
A division of Sony Service Centre (Europe) N.V.	
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium	
VAT BE 0413.825.160 · RPR Brussels	
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

Re: Too verbose compat_ioctl messages?

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2007-07-06 16:31:44

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

Re: Too verbose compat_ioctl messages?

From: Andi Kleen <hidden>
Date: 2007-07-06 17:19:37

"H. Peter Anvin" [off-list ref] writes:
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.
ENOTTY is so excessively misnamed that it is actually surprising
anybody ever got that "right" (for very small values of right i guess)

-Andi

Re: Too verbose compat_ioctl messages?

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2007-07-06 17:49:15

Andi Kleen wrote:
"H. Peter Anvin" [off-list ref] writes:
quoted
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.
ENOTTY is so excessively misnamed that it is actually surprising
anybody ever got that "right" (for very small values of right i guess)
No argument there.

	-hpa

Re: Too verbose compat_ioctl messages?

From: Jeremy Fitzhardinge <hidden>
Date: 2007-07-06 18:33:53

Andi Kleen wrote:
"H. Peter Anvin" [off-list ref] writes:
  
quoted
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.
    
ENOTTY is so excessively misnamed that it is actually surprising
anybody ever got that "right" (for very small values of right i guess)
  
But it *isn't* a typewriter.  Of course, it's not a giraffe either.

    J

Re: Too verbose compat_ioctl messages?

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2007-07-06 18:37:28

Jeremy Fitzhardinge wrote:
quoted
ENOTTY is so excessively misnamed that it is actually surprising
anybody ever got that "right" (for very small values of right i guess)
But it *isn't* a typewriter.  Of course, it's not a giraffe either.
The union of things that are not typewriters and not giraffes are rather
large, indeed.

This is getting philosophical.

	-hpa

Re: Too verbose compat_ioctl messages?

From: Jeremy Fitzhardinge <hidden>
Date: 2007-07-06 18:41:08

H. Peter Anvin wrote:
The union of things that are not typewriters and not giraffes are rather
large, indeed.

This is getting philosophical.
  
I think my point is that we're rather short of good quality open source 
giraffe drivers.

    J

Re: Too verbose compat_ioctl messages?

From: Andi Kleen <hidden>
Date: 2007-07-06 19:05:21

On Fri, Jul 06, 2007 at 11:33:43AM -0700, Jeremy Fitzhardinge wrote:
Andi Kleen wrote:
quoted
"H. Peter Anvin" [off-list ref] writes:
 
quoted
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.
   
ENOTTY is so excessively misnamed that it is actually surprising
anybody ever got that "right" (for very small values of right i guess)
 
But it *isn't* a typewriter. 
Most ioctls are not related to ttys in any way.

-Andi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help