On Wed, Jun 01, 2022 at 08:19:14PM +0100, Matthew Wilcox wrote: > On Wed, Jun 01, 2022 at 03:20:29PM +0200, Alexey Gladkov wrote: > > +struct ctl_fops { > > + int (*open) (struct ctl_context *, struct inode *, struct file *); > > + int (*release) (struct ctl_context *, struct inode *, struct file *); > > + ssize_t (*read) (struct ctl_context *, struct file *, char *, size_t *, loff_t *); > > + ssize_t (*write) (struct ctl_context *, struct file *, char *, size_t *, loff_t *); > > +}; > > Why not pass the iocb in ->read and ->write? We're still regretting not > doing that with file_operations. Because buf and len can be modified in BPF_CGROUP_RUN_PROG_SYSCTL. We need to pass the result of this hook to read/write callback. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/proc_sysctl.c#n605 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/bpf/cgroup.c#n1441 -- Rgrds, legion