Re: [PATCH v2 14/36] fs: add ksys_mount() helper; remove in-kernel calls to sys_mount()

From: Christoph Hellwig
Date: Fri Mar 16 2018 - 04:47:02 EST


On Thu, Mar 15, 2018 at 09:11:27PM +0100, Arnd Bergmann wrote:
> Shouldn't the callers of sys_mount just call do_mount() instead?
>
> As I understand it, sys_mount is already a wrapper around do_mount()
> that copies its arguments from user space, but we don't need that
> when called from inside the kernel.

In general yes. do_mount.c has some really strange calling context
where it tries to operate on kernel and user pointers interchangably,
but even with that just switching to do_mount seems like the right thing
to me. In fact once we do that and take care or chdir/chdoot we could
probably get rid of the sparse disable hack in favour of a few __force
casts in change_floppy and sort this mess out as well.