linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFCLUE2] 64 bit driver 32 bit app ioctl
@ 2006-03-23 15:06 William D Waddington
  2006-03-23 16:42 ` Mikael Pettersson
  2006-03-23 16:49 ` Arjan van de Ven
  0 siblings, 2 replies; 6+ messages in thread
From: William D Waddington @ 2006-03-23 15:06 UTC (permalink / raw)
  To: linux-kernel

Apologies for dashing this off without the proper homework.  My
customer is out of country doing an installation, and didn't test
this configuration first :(

Customer is running RHEL3 on a 64 bit PC.  Running the 64 bit kernel
and my 64 bit driver.  They are calling the driver from their 32 bit
app.  The driver supports a whole mess of ioctls.

It seems that the kernel is trapping the 32-bit ioctl call and returning
an error to the app w/out calling the driver.  It looks like
register_ioctl32_conversion() can convice the kernel that the driver can
handle 32-bit calls, but it has to be called for each ioctl cmd (??)

Putting aside (please) discussion of whether the kernel should presume
to hijack private ioctls, and whether I should be using the ioctl
interface at all (compatibility with app interface going back to 2.0
and SunOS) is there some way to make _one_ register call to indicate
that all my cmds are safe, or maybe an alternate ioctl entry point
that the  kernel won't trap?

Yours in desperation,
Bill

-- 
--------------------------------------------
William D Waddington
Bainbridge Island, WA, USA
william.waddington@beezmo.com
--------------------------------------------
"Even bugs...are unexpected signposts on
the long road of creativity..." - Ken Burtch


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

* Re: [RFCLUE2] 64 bit driver 32 bit app ioctl
  2006-03-23 15:06 [RFCLUE2] 64 bit driver 32 bit app ioctl William D Waddington
@ 2006-03-23 16:42 ` Mikael Pettersson
  2006-03-24 19:00   ` William D Waddington
  2006-03-23 16:49 ` Arjan van de Ven
  1 sibling, 1 reply; 6+ messages in thread
From: Mikael Pettersson @ 2006-03-23 16:42 UTC (permalink / raw)
  To: William D Waddington; +Cc: linux-kernel

William D Waddington writes:
 > Apologies for dashing this off without the proper homework.  My
 > customer is out of country doing an installation, and didn't test
 > this configuration first :(
 > 
 > Customer is running RHEL3 on a 64 bit PC.  Running the 64 bit kernel
 > and my 64 bit driver.  They are calling the driver from their 32 bit
 > app.  The driver supports a whole mess of ioctls.
 > 
 > It seems that the kernel is trapping the 32-bit ioctl call and returning
 > an error to the app w/out calling the driver.  It looks like
 > register_ioctl32_conversion() can convice the kernel that the driver can
 > handle 32-bit calls, but it has to be called for each ioctl cmd (??)

In these old pre-compat_ioctl kernels you have to register each
ioctl command individually. Yes that sucks. Live with it.

 > Putting aside (please) discussion of whether the kernel should presume
 > to hijack private ioctls, and whether I should be using the ioctl
 > interface at all (compatibility with app interface going back to 2.0
 > and SunOS) is there some way to make _one_ register call to indicate
 > that all my cmds are safe, or maybe an alternate ioctl entry point
 > that the  kernel won't trap?

Not as long as you're stuck with old 2.4 kernels. 2.6 kernels since
2.6.11-rc2 allow you to set up a single ->compat_ioctl() method,
but not even RHEL4 has that yet.

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

* Re: [RFCLUE2] 64 bit driver 32 bit app ioctl
  2006-03-23 15:06 [RFCLUE2] 64 bit driver 32 bit app ioctl William D Waddington
  2006-03-23 16:42 ` Mikael Pettersson
@ 2006-03-23 16:49 ` Arjan van de Ven
  2006-03-23 16:57   ` Avi Kivity
  2006-03-23 18:33   ` William D Waddington
  1 sibling, 2 replies; 6+ messages in thread
From: Arjan van de Ven @ 2006-03-23 16:49 UTC (permalink / raw)
  To: William D Waddington; +Cc: linux-kernel

On Thu, 2006-03-23 at 07:06 -0800, William D Waddington wrote:
> Apologies for dashing this off without the proper homework.  My
> customer is out of country doing an installation, and didn't test
> this configuration first :(
> 
> Customer is running RHEL3 on a 64 bit PC.  Running the 64 bit kernel
> and my 64 bit driver.  They are calling the driver from their 32 bit
> app.  The driver supports a whole mess of ioctls.
> 
> It seems that the kernel is trapping the 32-bit ioctl call and returning
> an error to the app w/out calling the driver.  It looks like
> register_ioctl32_conversion() can convice the kernel that the driver can
> handle 32-bit calls, but it has to be called for each ioctl cmd (??)

you forgot to attach you code btw or post the url to it..



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

* Re: [RFCLUE2] 64 bit driver 32 bit app ioctl
  2006-03-23 16:49 ` Arjan van de Ven
@ 2006-03-23 16:57   ` Avi Kivity
  2006-03-23 18:33   ` William D Waddington
  1 sibling, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2006-03-23 16:57 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: William D Waddington, linux-kernel

Arjan van de Ven wrote:
> On Thu, 2006-03-23 at 07:06 -0800, William D Waddington wrote:
>   
> [...]
> you forgot to attach you code btw or post the url to it..
>
>   
is that your new .signature?

 :)

-- 
error compiling committee.c: too many arguments to function


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

* Re: [RFCLUE2] 64 bit driver 32 bit app ioctl
  2006-03-23 16:49 ` Arjan van de Ven
  2006-03-23 16:57   ` Avi Kivity
@ 2006-03-23 18:33   ` William D Waddington
  1 sibling, 0 replies; 6+ messages in thread
From: William D Waddington @ 2006-03-23 18:33 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

Arjan van de Ven wrote:
> On Thu, 2006-03-23 at 07:06 -0800, William D Waddington wrote:
> 
>>Apologies for dashing this off without the proper homework.  My
>>customer is out of country doing an installation, and didn't test
>>this configuration first :(
>>
>>Customer is running RHEL3 on a 64 bit PC.  Running the 64 bit kernel
>>and my 64 bit driver.  They are calling the driver from their 32 bit
>>app.  The driver supports a whole mess of ioctls.
>>
>>It seems that the kernel is trapping the 32-bit ioctl call and returning
>>an error to the app w/out calling the driver.  It looks like
>>register_ioctl32_conversion() can convice the kernel that the driver can
>>handle 32-bit calls, but it has to be called for each ioctl cmd (??)
> 
> 
> you forgot to attach you code btw or post the url to it..

No I didn't :) It's just too ugly for public view.  And I notice it
needs some other fix-ups like fixed width data types in the ioctl
routine...

Thanks to all for the info.  I've got some typing to do.

Bill


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

* Re: [RFCLUE2] 64 bit driver 32 bit app ioctl
  2006-03-23 16:42 ` Mikael Pettersson
@ 2006-03-24 19:00   ` William D Waddington
  0 siblings, 0 replies; 6+ messages in thread
From: William D Waddington @ 2006-03-24 19:00 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: linux-kernel



Mikael Pettersson wrote:
> William D Waddington writes:
>  > Apologies for dashing this off without the proper homework.  My
>  > customer is out of country doing an installation, and didn't test
>  > this configuration first :(
>  > 
>  > Customer is running RHEL3 on a 64 bit PC.  Running the 64 bit kernel
>  > and my 64 bit driver.  They are calling the driver from their 32 bit
>  > app.  The driver supports a whole mess of ioctls.
>  > 
>  > It seems that the kernel is trapping the 32-bit ioctl call and returning
>  > an error to the app w/out calling the driver.  It looks like
>  > register_ioctl32_conversion() can convice the kernel that the driver can
>  > handle 32-bit calls, but it has to be called for each ioctl cmd (??)
> 
> In these old pre-compat_ioctl kernels you have to register each
> ioctl command individually. Yes that sucks. Live with it.
> 
>  > Putting aside (please) discussion of whether the kernel should presume
>  > to hijack private ioctls, and whether I should be using the ioctl
>  > interface at all (compatibility with app interface going back to 2.0
>  > and SunOS) is there some way to make _one_ register call to indicate
>  > that all my cmds are safe, or maybe an alternate ioctl entry point
>  > that the  kernel won't trap?
> 
> Not as long as you're stuck with old 2.4 kernels. 2.6 kernels since
> 2.6.11-rc2 allow you to set up a single ->compat_ioctl() method,
> but not even RHEL4 has that yet.

Thanks,

It's working OK in my test cases: FC1/64 and the customer's RHEL3.  I
just #include <asm/ioctl32.h> and register all my ioctls.  Ugh.

The location of ioctl32.h seems to move from 2.4 kernel to kernel (and
distro to distro??).  Any suggestion how to include in a universal way
and how to detect all the appropriate 64 bit configs for conditional
inclusion w/a 2.4 kernel?  I detest #ifdef'd code but I guess I have to
do that too, or just keep one version around for this specific case :(

Thanks again,
Bill
--------------------------------------------
William D Waddington
Bainbridge Island, WA, USA
william.waddington@beezmo.com
--------------------------------------------
"Even bugs...are unexpected signposts on
the long road of creativity..." - Ken Burtch


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

end of thread, other threads:[~2006-03-24 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-23 15:06 [RFCLUE2] 64 bit driver 32 bit app ioctl William D Waddington
2006-03-23 16:42 ` Mikael Pettersson
2006-03-24 19:00   ` William D Waddington
2006-03-23 16:49 ` Arjan van de Ven
2006-03-23 16:57   ` Avi Kivity
2006-03-23 18:33   ` William D Waddington

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).