linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* unregister_ioctl32_conversion and modules. ioctl32 revisited.
@ 2004-12-15  6:56 Andi Kleen
  2004-12-15  7:46 ` Michael S. Tsirkin
  2004-12-17  1:43 ` [PATCH] " Michael S. Tsirkin
  0 siblings, 2 replies; 246+ messages in thread
From: Andi Kleen @ 2004-12-15  6:56 UTC (permalink / raw)
  To: mst, linux-kernel; +Cc: pavel, discuss, gordon.jin

Hallo,

There seems to be an unfixable module unload race in the current
register_ioctl32_conversion support. The problem is that
there is no way to wait for a conversion handler is blocked
in a sleeping *_user access before module unloading. The module
count is also not increase in this case.

I previously thought it could be avoided by always putting
the compat wrapper into the same module and using the reference
counting that is done by VFS on ->module of the char device or
file system converted. But that doesn't work because 
the ioctl32 lookup is independent from the file descriptor
and a conversion handler can be entered even after ->release
when the right number is passed.

One way to fix it would be to put a pointer to the module
into the compat ioctl hash table and increase the module count atomically
from the compat code. But that would bloat the hash table a lot
and I don't like it very much. Also you would either break the
register_ioctl32_conversion prototype or make it a macro
and assume all calls are from the same module, which is also 
quite ugly.

A better solution would be to switch the few users of 
register_ioctl32_conversion() over to a new ->ioctl32 method
in file_operations and do the conversion from there. This would
avoid the race because the VFS will take care of the module
count in open/release.

Michael did a patch for this some time ago for a different motivation -
he had some benchmarks where the hash table lookup hurt and it was
noticeable faster to use a O(1) ->ioctl32 lookup from the file_operations
for his application.

An useful side effect would be also to the ability to support 
a per device ioctl name space. While the core kernel doesn't have
much (any?) ioctls with duplicated numbers this mistake seems
to be quite common in out of tree drivers and it is hard to 
fix without breaking compatibility.

And it would be faster for this case of course too, so even performance
critical in kernel ioctls could be slowly converted to ioctl32
I wouldn't do it for all, because the current central tables work
reasonably well for them and most ioctls are not speed critical
anyways.

As for in kernel code it won't affect much code because near 
all conversion handlers in the main tree are not modular (alsa 
is one exception, there are a few others e.g. in some raid drivers). 
I expect it will be a bigger problem in the future though as ioctl 
emulation becomes more widespread and is done more in individual drivers.

averell:lsrc/v2.6/linux% gid register_ioctl32_conversion | wc -l
75
averell:lsrc/v2.6/linux% 

In tree users are alsa, aaraid, fusion, some s390 stuff, sisfb, alsa

My proposal would be to dust off Michael's patch and convert 
all users in tree over to ioctl32 and then deprecate and later remove
(un)register_ioctl32_conversion 

Comments?

-Andi

^ permalink raw reply	[flat|nested] 246+ messages in thread

end of thread, other threads:[~2005-02-03 16:39 UTC | newest]

Thread overview: 246+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-15  6:56 unregister_ioctl32_conversion and modules. ioctl32 revisited Andi Kleen
2004-12-15  7:46 ` Michael S. Tsirkin
2004-12-15  8:00   ` Andi Kleen
2004-12-15  8:21     ` Michael S. Tsirkin
2004-12-15  8:29       ` Andi Kleen
2004-12-15 11:42         ` Michael S. Tsirkin
2004-12-15 13:46           ` Arnd Bergmann
2004-12-15 16:12             ` Andi Kleen
2004-12-15 16:45               ` Arnd Bergmann
2004-12-15 16:57                 ` Andi Kleen
2004-12-15 17:47                   ` Arnd Bergmann
2004-12-15 17:59                     ` Andi Kleen
2004-12-15 18:21                     ` Michael S. Tsirkin
2004-12-16  4:06                       ` Andi Kleen
2004-12-26 22:26                         ` Chris Wedgwood
2004-12-26 22:49                           ` [discuss] " Arnd Bergmann
2004-12-27 11:49                             ` [discuss] Re: unregister_ioctl32_conversion and modules. ioct l32 revisited Michael S. Tsirkin
2005-01-05 15:25                             ` Michael S. Tsirkin
2005-01-05 16:07                               ` Arnd Bergmann
2004-12-15 18:20   ` unregister_ioctl32_conversion and modules. ioctl32 revisited Takashi Iwai
2004-12-15 18:30     ` Lee Revell
2004-12-15 19:34       ` Michael S. Tsirkin
2004-12-16  5:03       ` [discuss] " Andi Kleen
2004-12-16  7:53         ` Ingo Molnar
2004-12-16  8:09           ` Andi Kleen
2004-12-16  8:25             ` Andrew Morton
2004-12-16  8:30               ` Michael S. Tsirkin
2004-12-16  8:38               ` Andi Kleen
2004-12-17  1:43 ` [PATCH] " Michael S. Tsirkin
2004-12-16 16:08   ` Christoph Hellwig
2005-01-03  9:11   ` 2.6.10-mm1 Andrew Morton
2005-01-03 10:07     ` 2.6.10-mm1 Christoph Hellwig
2005-01-03 17:19       ` 2.6.10-mm1 Jesse Barnes
2005-01-03 23:29         ` 2.6.10-mm1 [failure on AMD64] Rafael J. Wysocki
2005-01-03 23:30           ` Jesse Barnes
2005-01-04 11:23           ` Thomas Molina
2005-01-04 13:22             ` Rafael J. Wysocki
2005-01-04 12:22           ` Andi Kleen
2005-01-04 21:05             ` Rafael J. Wysocki
2005-01-06 11:32       ` 2.6.10-mm1 Christoph Hellwig
2005-01-06 13:04       ` 2.6.10-mm1 David Howells
2005-01-06 13:06         ` 2.6.10-mm1 Christoph Hellwig
2005-01-03 10:25     ` 2.6.10-mm1 Christoph Hellwig
2005-01-03 13:21       ` 2.6.10-mm1 Christoph Hellwig
2005-01-03 13:35       ` 2.6.10-mm1 Michael S. Tsirkin
2005-01-03 11:48     ` 2.6.10-mm1 Christoph Hellwig
2005-01-05 17:27       ` 2.6.10-mm1 Hans Reiser
2005-01-06 13:52         ` 2.6.10-mm1 Vladimir Saveliev
2005-01-07 14:46           ` 2.6.10-mm1 Christoph Hellwig
2005-01-07 17:16             ` [RFC] per thread page reservation patch Vladimir Saveliev
2005-01-07 18:48               ` Andrew Morton
2005-01-07 20:21                 ` Nikita Danilov
2005-01-07 19:05               ` Christoph Hellwig
2005-01-07 19:12                 ` Christoph Hellwig
2005-01-07 19:21                 ` Robert Love
2005-01-07 20:48                 ` Nikita Danilov
2005-01-07 20:54                   ` Christoph Hellwig
2005-01-07 21:00                     ` Nikita Danilov
2005-01-07 21:07                       ` Christoph Hellwig
2005-01-07 19:14               ` Paulo Marques
2005-01-07 19:32                 ` Christoph Hellwig
2005-01-07 19:42                   ` Andi Kleen
2005-01-07 20:55                 ` Nikita Danilov
2005-01-07 21:24                   ` Andrew Morton
2005-01-07 21:24                     ` Andi Kleen
2005-01-07 22:12                     ` Nikita Danilov
2005-01-07 23:03                       ` Andrew Morton
2005-01-07 23:17                         ` Nikita Danilov
2005-01-07 23:43                           ` Andrew Morton
2005-01-08 12:44                             ` Nikita Danilov
2005-01-08 13:43                               ` Hugh Dickins
2005-01-09 11:35                             ` Marcelo Tosatti
2005-01-09 18:16                               ` Nikita Danilov
2005-01-25 16:39                     ` reiser4 core patches: [Was: [RFC] per thread page reservation patch] Vladimir Saveliev
2005-01-27 10:37                       ` Adrian Bunk
2005-01-27 11:01                       ` Christoph Hellwig
2005-01-03 11:51     ` 2.6.10-mm1 Christoph Hellwig
2005-01-04  9:04       ` 2.6.10-mm1 Ingo Molnar
2005-01-04  9:26         ` 2.6.10-mm1 Christoph Hellwig
2005-01-04  9:33           ` 2.6.10-mm1 Ingo Molnar
2005-01-03 15:13     ` 2.6.10-mm1 William Lee Irwin III
2005-01-03 17:17     ` 2.6.10-mm1 Jesse Barnes
2005-01-05 22:38       ` 2.6.10-mm1 Matthew Dobson
2005-01-03 20:42     ` [PATCH] pktcdvd: make two functions static Peter Osterlund
2005-01-03 20:45       ` [PATCH] pktcdvd: grep-friendly function prototypes Peter Osterlund
2005-01-03 20:47         ` [PATCH] pktcdvd: Small documentation update Peter Osterlund
2005-01-03 20:53           ` [PATCH] isofs: Remove useless include Peter Osterlund
2005-01-03 20:58             ` [PATCH] synaptics: Remove unused struct member variable Peter Osterlund
2005-01-03 22:25       ` [PATCH] pktcdvd: make two functions static Bartlomiej Zolnierkiewicz
2005-01-04  9:08     ` 2.6.10-mm1 Ingo Molnar
2005-01-05 14:40     ` [PATCH] deprecate (un)register_ioctl32_conversion Michael S. Tsirkin
2005-01-05 14:46       ` Christoph Hellwig
2005-01-05 15:03         ` Michael S. Tsirkin
2005-01-05 15:11           ` Christoph Hellwig
2005-01-05 21:33           ` Andrew Morton
2005-01-06 14:41             ` Michael S. Tsirkin
2005-01-06 14:55               ` Christoph Hellwig
2005-01-06 15:22                 ` Michael S. Tsirkin
2005-01-06 15:30                   ` Christoph Hellwig
2005-01-06 15:56                     ` Michael S. Tsirkin
2005-01-05 15:19         ` Andi Kleen
2005-01-05 15:55           ` Christoph Hellwig
2005-01-05 18:23       ` Takashi Iwai
2005-01-05 21:34         ` Andrew Morton
2005-01-06  8:22           ` 2.6.10-mm2 Andrew Morton
2005-01-06  8:39             ` 2.6.10-mm2 Nick Piggin
2005-01-06  9:11             ` 2.6.10-mm2 Eyal Lebedinsky
2005-01-06  9:24               ` 2.6.10-mm2 Andrew Morton
2005-01-06  9:27               ` 2.6.10-mm2 Christoph Hellwig
2005-01-06 10:17             ` 2.6.10-mm2 Juri Prokofjev
2005-01-06 14:54               ` 2.6.10-mm2 Dave Airlie
2005-01-06 10:17             ` [PATCH 2.6.10-mm2] m32r: build fix Hirokazu Takata
2005-01-06 10:47             ` 2.6.10-mm2 Christoph Hellwig
2005-01-06 11:19             ` 2.6.10-mm2 error: redefinition of `struct cfq_io_context' Helge Hafting
2005-01-06 14:21               ` Helge Hafting
2005-01-06 12:06             ` 2.6.10-mm2 Marcos D. Marado Torres
2005-01-11 14:08               ` acpi_power_off on 2.6.10-mm3 WAS: 2.6.10-mm2 Marcos D. Marado Torres
2005-01-06 12:48             ` 2.6.10-mm2 Sam Ravnborg
2005-01-06 18:15               ` 2.6.10-mm2 Felipe Alfaro Solana
2005-01-06 14:51             ` [PATCH] fget_light/fput_light for ioctls Michael S. Tsirkin
2005-01-06 16:18               ` [PATCH] fget_light/fput_light for ioctls (fixed) Michael S. Tsirkin
2005-01-06 15:00             ` [patch] 2.6.10-mm2: remove umsdos MAINTAINERS entry Adrian Bunk
2005-01-06 15:03             ` [patch] 2.6.10-mm2: fix MTD_BLOCK2MTD dependency Adrian Bunk
2005-01-08 20:18               ` Jörn Engel
2005-01-06 17:11             ` 2.6.10-mm2 Alexander Gran
2005-01-06 17:55               ` 2.6.10-mm2 Diego Calleja
2005-01-06 18:17                 ` 2.6.10-mm2 Marc Ballarin
2005-01-06 17:48             ` 2.6.10-mm2: swsusp regression Rafael J. Wysocki
2005-01-06 22:52               ` Pavel Machek
2005-01-06 23:41                 ` Rafael J. Wysocki
2005-01-06 23:48                   ` Pavel Machek
2005-01-07  0:24                     ` Nigel Cunningham
2005-01-07  0:29                       ` Pavel Machek
2005-01-07  0:45                         ` Nigel Cunningham
2005-01-07 12:45                     ` Rafael J. Wysocki
2005-01-07 22:12                       ` Nigel Cunningham
2005-01-08  0:56                         ` Rafael J. Wysocki
2005-01-08  9:49                           ` 2.6.10-mm2: swsusp regression [update] Rafael J. Wysocki
2005-01-08  9:56                             ` Nigel Cunningham
2005-01-08 13:19                             ` Pavel Machek
2005-01-08 15:10                               ` Rafael J. Wysocki
2005-01-08 15:44                                 ` Pavel Machek
2005-01-12 18:51                                   ` Rafael J. Wysocki
2005-01-12 21:01                                     ` Pavel Machek
2005-01-12 22:44                                       ` Rafael J. Wysocki
2005-01-12 22:46                                         ` Pavel Machek
2005-01-12 22:58                                           ` Nigel Cunningham
2005-01-12 23:02                                           ` Rafael J. Wysocki
2005-01-12 23:28                                             ` Nigel Cunningham
2005-01-13  0:59                                               ` [PATCH] Fix a bug in timer_suspend() on x86_64 Rafael J. Wysocki
2005-01-13 10:08                                                 ` Pavel Machek
2005-01-13 10:14                                                   ` Nigel Cunningham
2005-01-13 19:47                                                 ` Andi Kleen
2005-01-08 17:22                                 ` 2.6.10-mm2: swsusp regression [update] Barry K. Nathan
2005-01-06 17:57             ` [patch] 2.6.10-mm2: move CPUSETS above EMBEDDED Adrian Bunk
2005-01-07  6:20               ` Paul Jackson
2005-01-06 18:15             ` [2.6 patch] 2.6.10-mm2: let I2C_ALGO_SGI depend on MIPS Adrian Bunk
     [not found]               ` <20050106192701.GA13955@linux-mips.org>
2005-01-06 19:35                 ` Ilya A. Volynets-Evenbakh
2005-01-06 19:46                   ` Greg KH
2005-01-07  9:12                     ` Ladislav Michl
2005-01-07 19:14                       ` Greg KH
2005-01-06 20:30             ` 2.6.10-mm2 Ramón Rey Vicente
2005-01-07  9:39             ` 2.6.10-mm2 Benoit Boissinot
2005-01-07 13:13               ` 2.6.10-mm2 Brice Goglin
2005-01-09  1:26                 ` 2.6.10-mm2 Dave Airlie
2005-01-09  8:55                   ` 2.6.10-mm2 Brice Goglin
2005-01-08  2:43               ` 2.6.10-mm2 Dave Airlie
2005-01-08 12:27                 ` 2.6.10-mm2 Benoit Boissinot
2005-01-08 13:42                   ` 2.6.10-mm2 Dave Airlie
2005-01-08 14:18                     ` 2.6.10-mm2 Marc Ballarin
2005-01-09  1:23                       ` 2.6.10-mm2 Dave Airlie
2005-01-08 16:46                     ` 2.6.10-mm2 Mike Werner
2005-01-08 13:48                   ` 2.6.10-mm2 Dave Airlie
2005-01-08 15:41                     ` 2.6.10-mm2 Benoit Boissinot
2005-01-09  1:38                       ` 2.6.10-mm2 Dave Airlie
2005-01-09 14:09                         ` 2.6.10-mm2 Benoit Boissinot
2005-01-09 14:15                           ` 2.6.10-mm2 Brice Goglin
2005-01-10  7:40                             ` 2.6.10-mm2 Dave Airlie
2005-01-10  7:49                               ` 2.6.10-mm2 Brice Goglin
     [not found]                                 ` <21d7e9970501100101353cf602@mail.gmail.com>
2005-01-10 10:14                                   ` 2.6.10-mm2 solved Brice Goglin
2005-01-10 16:41                                     ` Brice Goglin
2005-01-08  1:31             ` AGP Oops (was Re: 2.6.10-mm2) Sean Neakums
2005-01-08  1:36               ` Andrew Morton
2005-01-08 13:01                 ` Sean Neakums
2005-01-06 14:06           ` [PATCH] macros to detect existance of unlocked_ioctl and ioctl_compat Michael S. Tsirkin
2005-01-06 14:53             ` Christoph Hellwig
2005-01-06 15:09               ` Andi Kleen
2005-01-06 15:14                 ` Christoph Hellwig
2005-01-06 15:22                   ` Lee Revell
2005-01-06 15:31                     ` Christoph Hellwig
2005-01-06 15:38                       ` Lee Revell
2005-01-06 19:03                       ` Catalin Marinas
2005-01-06 15:37                   ` Andi Kleen
2005-01-06 16:58                   ` Petr Vandrovec
2005-01-06 16:35               ` Petr Vandrovec
2005-01-06 16:39                 ` Christoph Hellwig
2005-01-06 16:57                 ` Andi Kleen
2005-01-06 17:26                   ` Petr Vandrovec
2005-01-06 17:53                     ` Andi Kleen
2005-01-06 18:19                       ` Petr Vandrovec
2005-01-06 19:35                       ` Greg KH
2005-01-06 19:51                         ` Andi Kleen
2005-01-06 19:59                           ` David S. Miller
2005-01-06 20:44                             ` Andi Kleen
2005-01-06 21:09                               ` Petr Vandrovec
2005-01-06 21:24                                 ` Greg KH
2005-01-06 21:59                                   ` [linux-usb-devel] " David Brownell
2005-01-06 22:48                                     ` Greg KH
2005-01-07 11:49                       ` [discuss] " Arnd Bergmann
2005-01-07 12:30                         ` Andi Kleen
2005-01-06 22:34                 ` Pavel Machek
2005-01-12 20:36             ` [PATCH] fix: macros to detect existance of unlocked_ioctl and compat_ioctl Michael S. Tsirkin
2005-01-12 21:29               ` Greg KH
2005-01-12 21:43                 ` Andi Kleen
2005-01-12 22:52                   ` Greg KH
2005-01-12 23:10                     ` Andrew Morton
2005-01-12 23:16                       ` Greg KH
2005-01-16  5:38                         ` Werner Almesberger
2005-01-20  5:38                       ` 2.6.11-rc1-mm2 Andrew Morton
2005-01-20  6:53                         ` 2.6.11-rc1-mm2: CONFIG_SMP=n compile error Adrian Bunk
2005-01-20  7:12                           ` Andrew Morton
2005-01-20 17:44                             ` Rafael J. Wysocki
2005-01-20  9:57                         ` 2.6.11-rc1-mm2 Steffen Klassert
2005-01-20 10:39                           ` 2.6.11-rc1-mm2 Christoph Hellwig
2005-01-20 11:40                         ` 2.6.11-rc1-mm2 Benoit Boissinot
2005-01-20 11:49                           ` 2.6.11-rc1-mm2 Benoit Boissinot
2005-01-20 11:58                         ` 2.6.11-rc1-mm2 Christoph Hellwig
2005-01-21  0:09                         ` security hook missing in compat ioctl in 2.6.11-rc1-mm2 Michael S. Tsirkin
2005-01-21  0:10                           ` Chris Wright
2005-01-21  1:26                           ` [PATCH] compat ioctl security hook fixup Chris Wright
2005-01-21  4:19                             ` Andi Kleen
2005-01-21  5:51                               ` Chris Wright
2005-01-21  6:11                                 ` Andi Kleen
2005-01-21  6:35                                   ` [PATCH] compat ioctl security hook fixup (take2) Chris Wright
2005-01-21  8:06                         ` 2.6.11-rc1-mm2 Con Kolivas
2005-01-21  8:30                           ` 2.6.11-rc1-mm2 Andrew Morton
2005-01-21  8:34                           ` 2.6.11-rc1-mm2 Andrew Morton
2005-01-21  8:37                             ` 2.6.11-rc1-mm2 Con Kolivas
2005-01-21 12:48                           ` 2.6.11-rc1-mm2 Adrian Bunk
2005-01-21 22:29                             ` 2.6.11-rc1-mm2 Con Kolivas
2005-01-21 22:43                         ` [PATCH] sched: account rt_tasks as iso_ticks Con Kolivas
2005-02-01  0:34                         ` 2.6.11-rc1-mm2 Ed Tomlinson
2005-02-03 16:36                           ` 2.6.11-rc1-mm2 Alexander Nyberg
2005-01-12 22:13                 ` [PATCH] fix: macros to detect existance of unlocked_ioctl and compat_ioctl Andreas Dilger
2005-01-12 22:58                   ` Greg KH
2005-01-13 10:57                     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).