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

From: Linus Torvalds
Date: Fri Mar 16 2018 - 12:58:53 EST


On Thu, Mar 15, 2018 at 1:11 PM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> Shouldn't the callers of sys_mount just call do_mount() instead?

So for most of these, I'd rather not really change the code and just
do a direct translation, but I have to agree that "sys_mount ->
do_mount" might be special.

As you say, the only thing sys_mount() does is to copy things from
user space and allocate temporaries, and then call do_mount(). And we
already use do_mount in other places.

So it translating sys_mount() to do_mount() might just be the right thing to do.

Of course, do_mount() still ends up doing yet more "translate user
mode stuff to kernel stuff", so it's kind o fa confusing half-way
state where the user mountpoint name is still in user space, and the
flags are still in the MS namespace, but the device name and the mount
options have been moved to kernel space.

So I dunno. It might make sense to convert to do_mount(), but in many
ways ksys_mount() that just passes *everything* as if it was a user
call is actually more logical, even if it's just pointless churn to
then copy things.

I do like the mindless "let's just use the SYSCALL_DEFINEx()
interfaces for in-kernel use" model, exactly because it's so
black-and-white and doesn't have these kinds of "on one hand.."
issues.

Linus