Re: is avoiding compat ioctls possible?

Dave Airlie
2009-10-28T03:28:08Z

On Wed, Oct 28, 2009 at 1:19 PM, Andi Kleen <andi@firstfloor.org> 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?
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.

>
>> and reviewed to do 32/64-bit properly. The s390 was something I didn't
>> know about but KMS on s390 is probably never going to be something
>> that sees the light of day.
>
> Well in theory there might be more architectures in the future
> which rely on compat_ptr
>

Well this was what I was trying to gather, so maybe I just need to write
something up to state that compat_ioctl is always required for new ioctls
that pass pointers or 64-bit values hiding pointers, so more people
don't make this mistake going forward. I can say when we inquired about this
2 or so years ago when designing kms I didn't get this answer, which is a pity.

Dave.