Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1142940ybl; Thu, 12 Dec 2019 10:16:15 -0800 (PST) X-Google-Smtp-Source: APXvYqy11wdZHJtgOl8pNS9FOPJhT9WH129ptmERYrHzlJJwHd91Q/l66EHbf488URPsbH7Nl+OE X-Received: by 2002:a9d:67d8:: with SMTP id c24mr9588269otn.172.1576174575530; Thu, 12 Dec 2019 10:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576174575; cv=none; d=google.com; s=arc-20160816; b=XvMsqE2R1zod8ekA9BLaopqJglBx7Y5tjR97EYBZPzU20HSZrZoGh1NkasPbq0h8v3 QXJIIuet9J7J1lOGnvhlLmEHBk3Wmskbn7f4xzaUP5u2IXf61L5H4/PMRfVSyPHuiAnq RnjhiDmsUStZz1+iz+A5aT2lDYqY6ND8x++GoyKNYJEzievByfYTOLEAl2HbGa92G403 Ka+Scm2uAU6LRoy540Dr/lMab3qU9N8BPRwziYYSkl3+OdZ/Pl7idzfITW6J67f5CXPb AHFR7oNSVmXNftMF7mawnHaPrj5H1BJxHjIo66G6ly1N2IQ+3yAhYLY9rujTNKgtVCTV 4k+w== 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=LUnVYiI1YOYSnWf0amKaJAODDi6lKUoeRAo9DtcMH64=; b=bHuyY4JOt9cTa4RdbSvy4IQjl+cFu/mp2oQ6CiQfQQVb6SB6AeirmHBAKFKCbNYqcF kVT0QOgXmHTLa7DbVdyWReaiKzUCYZimN6Y7p7UU7k3uOJsUKohXxfZE/JE71xR0QFmN mPx2yDD4rWfJqnaTrLmMJoBlGj9QlcEssGsLPMEJ6jaw6x7ZTk+8Y++KEg1szVxWs8ih +kjFYSZkezaldwh7LA8JwosjnQL3LLqNB09A2YgyYTgp1PExE1FpTwCZa5G7N97ybBqD l02KNRoNR2/gzZWHWumOhyeMxQJbtM39hNbKdhA6vZZo30D9u4D0iwPp5raV0WyFrOhu gqtw== 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 b10si3222515oib.205.2019.12.12.10.16.02; Thu, 12 Dec 2019 10:16:15 -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 S1730329AbfLLSOf (ORCPT + 99 others); Thu, 12 Dec 2019 13:14:35 -0500 Received: from isilmar-4.linta.de ([136.243.71.142]:56744 "EHLO isilmar-4.linta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730296AbfLLSOf (ORCPT ); Thu, 12 Dec 2019 13:14:35 -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 D8980200A87; Thu, 12 Dec 2019 18:14:33 +0000 (UTC) Received: by light.dominikbrodowski.net (Postfix, from userid 1000) id E118020B6E; 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 2/5] initrd: use do_mount() instead of ksys_mount() Date: Thu, 12 Dec 2019 19:14:19 +0100 Message-Id: <20191212181422.31033-3-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 All three calls to ksys_mount() in initrd-related kernel code can be switched over to do_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 --- init/do_mounts_initrd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index a9c6cc56f505..3bf7b74153ab 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -54,7 +54,7 @@ static int init_linuxrc(struct subprocess_info *info, struct cred *new) ksys_dup(0); /* move initrd over / and chdir/chroot in initrd root */ ksys_chdir("/root"); - ksys_mount(".", "/", NULL, MS_MOVE, NULL); + do_mount(".", "/", NULL, MS_MOVE, NULL); ksys_chroot("."); ksys_setsid(); return 0; @@ -89,7 +89,7 @@ static void __init handle_initrd(void) current->flags &= ~PF_FREEZER_SKIP; /* move initrd to rootfs' /old */ - ksys_mount("..", ".", NULL, MS_MOVE, NULL); + do_mount("..", ".", NULL, MS_MOVE, NULL); /* switch root and cwd back to / of rootfs */ ksys_chroot(".."); @@ -103,7 +103,7 @@ static void __init handle_initrd(void) mount_root(); printk(KERN_NOTICE "Trying to move old root to /initrd ... "); - error = ksys_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL); + error = do_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL); if (!error) printk("okay\n"); else { -- 2.24.1