The module net:sunrpc:cache.c will effectively use the same callback cache_ioctl for pointers passed from file_operations.unlocked_ioctl and proc_ops.proc_ioctl and it expects pointers as the argument. Thus to be able to pass CHERI capabilities, the .proc_ioctl fp's arg input should also be of user_uintptr_t type.
The proc_compat_ioctl handler in the pci/proc.c module is replaced with compat_noptr_ioctl as the arg is not being passed as a pointer into the proc_bus_pci_ioctl handler.
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- drivers/pci/proc.c | 4 ++-- include/linux/proc_fs.h | 2 +- net/sunrpc/cache.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index f967709082d6..dfd7a3d3a89e 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c @@ -192,7 +192,7 @@ struct pci_filp_private { #endif /* HAVE_PCI_MMAP */
static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) + user_uintptr_t arg) { struct pci_dev *dev = pde_data(file_inode(file)); #ifdef HAVE_PCI_MMAP @@ -322,7 +322,7 @@ static const struct proc_ops proc_bus_pci_ops = { .proc_write = proc_bus_pci_write, .proc_ioctl = proc_bus_pci_ioctl, #ifdef CONFIG_COMPAT - .proc_compat_ioctl = proc_bus_pci_ioctl, + .proc_compat_ioctl = compat_noptr_ioctl, #endif #ifdef HAVE_PCI_MMAP .proc_open = proc_bus_pci_open, diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 81d6e4ec2294..11d6c3620175 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -36,7 +36,7 @@ struct proc_ops { loff_t (*proc_lseek)(struct file *, loff_t, int); int (*proc_release)(struct inode *, struct file *); __poll_t (*proc_poll)(struct file *, struct poll_table_struct *); - long (*proc_ioctl)(struct file *, unsigned int, unsigned long); + long (*proc_ioctl)(struct file *, unsigned int, user_uintptr_t); #ifdef CONFIG_COMPAT long (*proc_compat_ioctl)(struct file *, unsigned int, unsigned long); #endif diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index c4aaef5430f1..b682aa223bd6 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -1573,7 +1573,7 @@ static __poll_t cache_poll_procfs(struct file *filp, poll_table *wait) }
static long cache_ioctl_procfs(struct file *filp, - unsigned int cmd, unsigned long arg) + unsigned int cmd, user_uintptr_t arg) { struct inode *inode = file_inode(filp); struct cache_detail *cd = pde_data(inode);