Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-29 Thread Al Viro
On Fri, May 29, 2020 at 01:57:36PM -0700, Linus Torvalds wrote: > > All jokes aside, when had we (or anybody else, really) _not_ gotten > > into trouble when passing structs across the kernel boundary? Sure, > > sometimes you have to (stat, for example), but just look at the amount > > of PITA st

Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-29 Thread Linus Torvalds
On Fri, May 29, 2020 at 1:46 PM Al Viro wrote: > > Umm... I'd been concerned about code generation, but it actually gets > split into a pair of scalars just fine... We actually have depended on that for a long time: our 'pte_t' etc on 32-bit kernels were very much about "structs of two words are

Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-29 Thread Al Viro
On Thu, May 28, 2020 at 08:42:25PM -0700, Linus Torvalds wrote: > > struct sigset_argpack argpack = { NULL, 0 }; > > > > if (get_sigset_argpack(sig, &argpack)) > > return -EFAULT; > > and now you can use "argpack.sigset" and "argpack.sigset_size". > > No? > > Sam

Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-28 Thread Linus Torvalds
On Thu, May 28, 2020 at 8:10 PM Al Viro wrote: > > BTW, regarding uaccess - how badly does the following offend your taste? > Normally I'd just go for copy_from_user(), but these syscalls just might > be hot enough for overhead to matter... Hmm. So the code itself per se doesn't really offend me,

Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-28 Thread Al Viro
On Thu, May 28, 2020 at 06:54:11PM -0700, Linus Torvalds wrote: > On Thu, May 28, 2020 at 6:47 PM Al Viro wrote: > > > > case S_IFREG: > > inode->i_op = &dlmfs_file_inode_operations; > > inode->i_fop = &dlmfs_file_operations; > > > > i_size_w

Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-28 Thread Linus Torvalds
On Thu, May 28, 2020 at 6:47 PM Al Viro wrote: > > case S_IFREG: > inode->i_op = &dlmfs_file_inode_operations; > inode->i_fop = &dlmfs_file_operations; > > i_size_write(inode, DLM_LVB_LEN); > is the only thing that does anything to size of t

Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-28 Thread Al Viro
On Thu, May 28, 2020 at 06:27:36PM -0700, Linus Torvalds wrote: > On Thu, May 28, 2020 at 5:04 PM Al Viro wrote: > > > > if (*ppos >= i_size_read(inode)) > > return 0; > > > > + /* don't read past the lvb */ > > + if (count > i_size_read(inode) - *ppos) > > +

Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-28 Thread Linus Torvalds
On Thu, May 28, 2020 at 5:04 PM Al Viro wrote: > > if (*ppos >= i_size_read(inode)) > return 0; > > + /* don't read past the lvb */ > + if (count > i_size_read(inode) - *ppos) > + count = i_size_read(inode) - *ppos; This isn't a new problem, since

[PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()

2020-05-28 Thread Al Viro
From: Al Viro Signed-off-by: Al Viro --- fs/ocfs2/dlmfs/dlmfs.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index 8e4f1ace467c..92f0a3bc3ac5 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/o