Re: [PATCH] macros to detect existance of unlocked_ioctl and ioctl_compat

From: Andi Kleen
Date: Thu Jan 06 2005 - 13:57:26 EST


[cc list trimmed]

On Thu, Jan 06, 2005 at 06:26:13PM +0100, Petr Vandrovec wrote:
> > Why are you issuing 64bit ioctls from 32bit applications?
>
> There are three reasons (main reason is that vmware is 32bit app, but it is how
> things are currently laid out; even if there will be 64bit app, 32bit versions are
> already in use and people wants to use them on 64bit kernels):
>
> * USB. usbfs API is written in a way which does not allow you to safely wrap
> it in "generic" 32->64 layer, and attempts to do it in non-generic way in usbfs
> code itself did not look feasible year ago. Even on current 64bit kernels it is not
> possible to issue raw USB operations from 32bit apps, and I do not believe that
> it is going to change - after all, just issuing ioctl through 64bit path from application
> which is aware of 64bit kernel is quite simple, much simpler than any attempt to
> make kernel dual-interface.

Agree that's a problem. We just need an alternative interface here
or I try to come up with an x86-64 specific hack (I think it's possible
to do the compatibility x86-64 specific, just not in compat code for
all architectures who have truly separated user/kernel address spaces)

I hope the USB people will eventually add a better interface here.
Greg?

>

> * parport interface, serial port: not all APIs were implemented in kernel. Current
> kernels do wrap all APIs vmware needs, but older kernels do not, and so we had to find
> some solution for older kernels too. Not so surprisingly, solution we had in place for
> USB works for them too...

But that's a non issue for the new kernels affected by the new ioctl
interface.

>
> * floppy: it is actually different from examples above, as FDRAWCMD command is
> supported by 32->64 layer, but it is supported incorrectly. Due to this all above
> started, as we had to make application aware of kernel it runs on, as FDRAWCMD on 32bit
> kernel returns 80 byte structure, while 104 byte on 64bit kernel, and you do not now
> which one you'll get until you call this ioctl... And once we had code in place,
> it was reused for USB and later for ppdev & serial.

Did you submit a patch for that? If not you should.

> So we added simple wrapper to vmmon which just gets {64bit-ioctl-number, 64bit-arg-argument}
> and passes it down to 64bit sys_ioctl:

The magic 64bit interface isn't a very good interface, don't expect
that to be supported in the future.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/