lkml.org 
[lkml]   [2018]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 14/36] fs: add ksys_mount() helper; remove in-kernel calls to sys_mount()
On Thu, Mar 15, 2018 at 8:05 PM, Dominik Brodowski
<linux@dominikbrodowski.net> wrote:
> Using this helper allows us to avoid the in-kernel calls to the sys_mount()
> syscall.
>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

> diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
> index 50025d7959cb..4afb04686c8e 100644
> --- a/drivers/base/devtmpfs.c
> +++ b/drivers/base/devtmpfs.c
> @@ -356,7 +356,8 @@ int devtmpfs_mount(const char *mntdir)
> if (!thread)
> return 0;
>
> - err = sys_mount("devtmpfs", (char *)mntdir, "devtmpfs", MS_SILENT, NULL);
> + err = ksys_mount("devtmpfs", (char *)mntdir, "devtmpfs", MS_SILENT,
> + NULL);
> if (err)
> printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
> else
> @@ -382,7 +383,7 @@ static int devtmpfsd(void *p)
> *err = sys_unshare(CLONE_NEWNS);
> if (*err)
> goto out;
> - *err = sys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options);
> + *err = ksys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options);
> if (*err)
> goto out;
> sys_chdir("/.."); /* will traverse into overmounted root */

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.

Arnd

\
 
 \ /
  Last update: 2018-03-15 21:12    [W:0.327 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site