Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1143747ybl; Thu, 12 Dec 2019 10:17:01 -0800 (PST) X-Google-Smtp-Source: APXvYqzPPI4e/a+LEvncqgmEBZy30CUvMDA9UWcNZ3GQim5K8LDC2tKMMhf+efv54r+UZd6rHnBG X-Received: by 2002:a05:6830:681:: with SMTP id q1mr9416251otr.162.1576174621001; Thu, 12 Dec 2019 10:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174620; cv=none; d=google.com; s=arc-20160816; b=JOrxrlEKzGQPe0Pn/vKxXC7KFDmWWNaQiamMDmblsILwxBeV2G1t/iolfbz8ay3UGF J7nkAcdTtXjk5/9WH+meariyhziHZz3Vt2PYL9k3DJp2a+uh2pb8508s3SS7dfXK0FrS xbMiUFhKJWiwzuHrVK3RbzrSiN1fHTKAflZpa0bfvLWvY+T0p0ktlMRZsa6J+DquNohq xUYuW0/W5t77rGk0D86xABs/9BvUIxtKyB3Osx59JrAPQSbSz1S+cosU92G2/4NJq/Ch pCrFkkWBp51KStI4O+OlYiW2y58eOO2sCPrVJVigDnpg4LPDqfat9xvZISUjFFBEJyfF MUKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7e0pz5/Z1E5IjNeSnuFQx+oa+4US8v7nEdmeaH3hR2w=; b=gqXWL5GUhEkV0c6lfkuTOUzFCD5DR0PGOgIGi+dArr6Ukr/OhYXTi1HB42bcTVVbqW EdIBPFfRkxxMgcPnZ6jA/HI/N268YmAL16/KaWvk1ssr4ScULvyOzI9jgVXPnj7MPTMN VHnoieX2/uMuzVrv2RGZuFWdjY4hL/mDWb9e2mXzM4C5l+UiTgVgVYNa7gKfaADZhKo0 6KuUVF1BFkPFo0ZQGyEpileJfvhvdAMbbp7v2oI/giBUjdbmh2wQSK4XNXeaFA+Q9+x3 cQoyZMvcYU7WInIA1KH7wcwWL0mRoEeNtXRKUOA0uqakZ+MeqRGSvv70FK2ET713QJnm ODeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f25si3417307otp.25.2019.12.12.10.16.48; Thu, 12 Dec 2019 10:17:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730378AbfLLSOq (ORCPT + 99 others); Thu, 12 Dec 2019 13:14:46 -0500 Received: from isilmar-4.linta.de ([136.243.71.142]:56762 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730317AbfLLSOg (ORCPT ); Thu, 12 Dec 2019 13:14:36 -0500 X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from light.dominikbrodowski.net (brodo.linta [10.1.0.102]) by isilmar-4.linta.de (Postfix) with ESMTPSA id D9B6E200A91; Thu, 12 Dec 2019 18:14:33 +0000 (UTC) Received: by light.dominikbrodowski.net (Postfix, from userid 1000) id 4579E20B6C; Thu, 12 Dec 2019 19:14:29 +0100 (CET) From: Dominik Brodowski To: Alexander Viro , Linus Torvalds Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , Andrew Morton , Ingo Molnar , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] devtmpfs: use do_mount() instead of ksys_mount() Date: Thu, 12 Dec 2019 19:14:18 +0100 Message-Id: <20191212181422.31033-2-linux@dominikbrodowski.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191212181422.31033-1-linux@dominikbrodowski.net> References: <20191212181422.31033-1-linux@dominikbrodowski.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In devtmpfs, do_mount() can be called directly instead of complex wrapping by ksys_mount(): - the first and third arguments are const strings in the kernel, and do not need to be copied over from userspace; - the fifth argument is NULL, and therefore no page needs to be copied over from userspace; - the second and fourth argument are passed through anyway. Signed-off-by: Dominik Brodowski --- drivers/base/devtmpfs.c | 6 +++--- include/linux/device.h | 4 ++-- init/do_mounts.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 30d0523014e0..6cdbf1531238 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c @@ -359,7 +359,7 @@ static int handle_remove(const char *nodename, struct device *dev) * If configured, or requested by the commandline, devtmpfs will be * auto-mounted after the kernel mounted the root filesystem. */ -int devtmpfs_mount(const char *mntdir) +int devtmpfs_mount(void) { int err; @@ -369,7 +369,7 @@ int devtmpfs_mount(const char *mntdir) if (!thread) return 0; - err = ksys_mount("devtmpfs", mntdir, "devtmpfs", MS_SILENT, NULL); + err = do_mount("devtmpfs", "dev", "devtmpfs", MS_SILENT, NULL); if (err) printk(KERN_INFO "devtmpfs: error mounting %i\n", err); else @@ -394,7 +394,7 @@ static int devtmpfsd(void *p) *err = ksys_unshare(CLONE_NEWNS); if (*err) goto out; - *err = ksys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, NULL); + *err = do_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, NULL); if (*err) goto out; ksys_chdir("/.."); /* will traverse into overmounted root */ diff --git a/include/linux/device.h b/include/linux/device.h index e226030c1df3..96ff76731e93 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1666,11 +1666,11 @@ extern bool kill_device(struct device *dev); #ifdef CONFIG_DEVTMPFS extern int devtmpfs_create_node(struct device *dev); extern int devtmpfs_delete_node(struct device *dev); -extern int devtmpfs_mount(const char *mntdir); +extern int devtmpfs_mount(void); #else static inline int devtmpfs_create_node(struct device *dev) { return 0; } static inline int devtmpfs_delete_node(struct device *dev) { return 0; } -static inline int devtmpfs_mount(const char *mountpoint) { return 0; } +static inline int devtmpfs_mount(void) { return 0; } #endif /* drivers/base/power/shutdown.c */ diff --git a/init/do_mounts.c b/init/do_mounts.c index af9cda887a23..43f6d098c880 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -670,7 +670,7 @@ void __init prepare_namespace(void) mount_root(); out: - devtmpfs_mount("dev"); + devtmpfs_mount(); ksys_mount(".", "/", NULL, MS_MOVE, NULL); ksys_chroot("."); } -- 2.24.1