Re: is avoiding compat ioctls possible?

From: David Miller
Date: Tue Oct 27 2009 - 23:41:39 EST


From: Dave Airlie <airlied@xxxxxxxxx>
Date: Wed, 28 Oct 2009 13:28:10 +1000

> On Wed, Oct 28, 2009 at 1:19 PM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
>> On Wed, Oct 28, 2009 at 01:05:08PM +1000, Dave Airlie wrote:
>>> We've designed that into a/c also, we pad all 64-bit values to 64-bit
>>> alignment on all the
>>> ioctls we've added to the drm in the past couple of years. Just because of
>>> this particular insanity.
>>
>> That's actually not needed, just use compat_*64.
>>>
>>> Assume no mistakes are made, new ioctls designed from scratch
>>
>> That seems like a bad assumption. It sounds like you already
>> made some.
>
> You mean its impossible to design a 32/64-bit safe ioctl no matter what?

If you use pointers at all, yes. We've said this several times.

> and we should live with having compat ioctls? This isn't something that was very
> clearly stated or documented, the advice we had previously was that
> compat ioctls
> were only required for old ioctls or ioctls with design problems. compat_*64
> didn't exist when this code we designed, and we worked around that, but it was
> in no way mistaken, manually aligning 64-bit values is a perfectly
> good solution,
> not sure why you imply it isn't.

Manually "aligning" the way you have solves only one side of the
compat problem on x86 with 64-bit types. It may handle the layout
properly bit it doesn't change the alignment requirements of the
containing structure and that's a similarly important the issue.

If you want to solve both aspects, use the "aligned_u64" type.

But once you introduce pointers, you must have compat layer code,
and this is a hard requirement. And there is nothing baroque or
wrong about it.
--
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/