Re: [PATCH 2/2] dlmfs: convert dlmfs_file_read() to copy_to_user()
From: Al Viro
Date: Fri May 29 2020 - 16:46:33 EST
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?
>
> Same exact deal for the compat case, where you'd just need that compat
> struct (using "compat_uptr_t" and "compat_size_t"), and then
>
> > struct compat_sigset_argpack argpack = { 0, 0 };
> >
> > + if (get_compat_sigset_argpack(sig, &argpack))
> > + return -EFAULT;
>
> and then you use the result with "compat_ptr(argpack.sigset)" and
> "argpack.sigset_size".
>
> Or did I mis-read anything and get confused by that code in your patch?
Umm... I'd been concerned about code generation, but it actually gets
split into a pair of scalars just fine...
Al, trying to resist the temptation to call those struct bad_idea and
struct bad_idea_32...
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 stat() has spawned...