Re: is avoiding compat ioctls possible?

Arnd Bergmann
2009-10-28T15:40:21Z

On Wednesday 28 October 2009, David Miller wrote:
> > The ioctl argument actually needs a compat_ptr() conversion as well.
> > For the s390 case, we can't do that in common code, because some
> > ioctl methods put a 32 bit integer into the argument. Not sure if we
> > want to fix that everywhere, the problem is very common and the
> > impact is minimal.
>
> What does s390 do with the 'arg' argument to sys_ioctl()?

It clears the top 32 bits, but not bit 31, because that is significant
for a few ioctl handlers passing data directly instead of a pointer.

> That assumption that you can cast this to a pointer is everywhere.

Yes, I know :(

> If someone wants to fix this up, feel free to do an audit and go
> over that seperately from my work :-)

Cc'ing Heiko and Martin, since I'm not working on s390 any more.

I'm pretty sure it was ok when we started adding the compat_ioctl
handlers years ago. I think most people just ignored these for
the majority of drivers that can't possibly run on s390. Even
on s390, gcc will always do the right thing if you call call ioctl
with a pointer to a normal object in the .data section, heap or stack,
but hand-written assembly or other compilers may not.