Fwd: Re: [PATCH 1/2] Staging: android: binder: Add support for 32bit binder calls in a 64bit kernel

Greg KH gregkh at linuxfoundation.org
Wed Dec 5 16:56:45 UTC 2012

On Wed, Dec 05, 2012 at 04:39:49PM +0000, Serban Constantinescu wrote:
> >I was wondering when someone would notice that this code was not going
> >to work for this type of system, nice to see that you are working to fix
> >it up.  But, I'll reask Dan's question here, why not use the compat32
> >ioctl interface instead?  Shouldn't that be the easier way to do this?
> Binder uses a 2 layer ioctl structure i.e. you can't know from the top
> of the ioctl handler the size of the incoming package.

How is this different from all other ioctl handlers in drivers?

> Therefore adding a wrapper for a 64bit kernel is not an option.

Really?  Have you tried?  And the wrapper isn't for the 64bit kernel,
it's the other way around, see the compat32 ioctl code for details.

> Should a 64bit Android ever appear we would probably want to support
> 32bit legacy applications.

I agree, this should be fixed, but please do so in the way that we fixed
the rest of the kernel for this problem, don't do it in a custom way

> For this we will need the same binder/ashmem driver to service both a
> 32bit application as well as a 64bit application in a 64bit kernel.
> Therefore I guess the way forward will be to support 32bit file systems
> in a 64bit kernel without any change to the existing user space
> (implemented in this patch) and at some point extend the ioctl range
> with the needed functionality for 64bit user space.

Filesystems shouldn't have anything to do with the problems, it's the
mode that the kernel is running in here, right?

> >Also, one meta comment, never use the uint32_t types, use the native
> >kernel types (u32 and the like.)  If you are crossing the user/kernel
> >boundry, use the other correct types for those data structures (__u32
> >and the like).  What you did here is mix and match things so much that I
> >really can't verify that it is all correct.
> I have tried to in-line my changes with the types already used in the
> driver but I will update to using the suggested types.

Feel free to send a patch first, to fix up the types in the drivers, and
then build on it, if you wish to make it easier for you.  I imagine this
will be a patch series anyway, if you wish to make it easy for us to
review (hint, you do...)


greg k-h

More information about the devel mailing list