[PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

Mauro Carvalho Chehab mchehab+samsung at kernel.org
Thu Apr 25 15:53:01 UTC 2019


Em Thu, 25 Apr 2019 16:35:34 +0100
Al Viro <viro at zeniv.linux.org.uk> escreveu:

> On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote:
> 
> > If I understand your patch description well, using compat_ptr_ioctl
> > only works if the driver is not for s390, right?  
> 
> No; s390 is where "oh, just set ->compat_ioctl same as ->unlocked_ioctl
> and be done with that; compat_ptr() is a no-op anyway" breaks.  IOW,
> s390 is the reason for having compat_ptr_ioctl() in the first place;
> that thing works on all biarch architectures, as long as all stuff
> handled by ->ioctl() takes pointer to arch-independent object as
> argument.  IOW,
> 	argument ignored => OK
> 	any arithmetical type => no go, compat_ptr() would bugger it
> 	pointer to int => OK

That's the case for all LIRC ioctls: they all use a pointer to u32
argument.

> 	pointer to string => OK
> 	pointer to u64 => OK
> 	pointer to struct {u64 addr; char s[11];} => OK
> 	pointer to long => needs explicit handler
> 	pointer to struct {void *addr; char s[11];} => needs explicit handler
> 	pointer to struct {int x; u64 y;} => needs explicit handler on amd64
> For "just use ->unlocked_ioctl for ->ioctl" we have
> 	argument ignored => OK
> 	any arithmetical type => OK
> 	any pointer => instant breakage on s390, in addtion to cases that break
> with compat_ptr_ioctl().
> 
> Probably some form of that ought to go into commit message for compat_ptr_ioctl()
> introduction...

Agreed.

Thanks,
Mauro


More information about the amd-gfx mailing list