From patchwork Sun Feb 26 00:54:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bosrsf04@gmail.com X-Patchwork-Id: 9592113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 619F360471 for ; Sun, 26 Feb 2017 01:04:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 448B728068 for ; Sun, 26 Feb 2017 01:04:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3843A283F6; Sun, 26 Feb 2017 01:04:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E58D728068 for ; Sun, 26 Feb 2017 01:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751926AbdBZBEE (ORCPT ); Sat, 25 Feb 2017 20:04:04 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:32859 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbdBZBED (ORCPT ); Sat, 25 Feb 2017 20:04:03 -0500 Received: by mail-qk0-f194.google.com with SMTP id x71so9369471qkb.0; Sat, 25 Feb 2017 17:04:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B4g8IFHdVwer7a7gSJcKDFf+Ip9cpYPiK11Ctw14Qoo=; b=lNeksBOcpEAdcQ4tfeeJBOLHkBdQXf1pWG4vhrkHE3coJOrsbrHjT3Cr26jLbjJP+X xxOd75uGXMnoaYVsuOprUJQfHGF7HOyJqSECegHrnDouwnO+g0GwdUjP9PiEeqHNU2vN W44kk5D1xa0fwgbykAuNXKR1/dJxsrADTYCfQbAOrRAa7JiWNri152S+8/2W7qH6U6hX alxIHYIomm99peTFRB8NFKnP6rxSQUPDRpZf8HumBJ0PD3HyilTj/lKM/T4Q/gpB7AQq okEeQY2ii8OjWvDFZM5hqfT2miNWn+3puOjP+5aFSJAxD/N1o2c2n1OiEK8NPO5Q8hZ2 sdfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B4g8IFHdVwer7a7gSJcKDFf+Ip9cpYPiK11Ctw14Qoo=; b=uocgpngl44YspNNpg6B3xoAefWkl8MpNOJvnUJ+dzA2oGLEHq3UkMHL1DnCdNx4ylX 7eeNyiAji000rZZqMaWp1P086ZjDmH7JnOht7sStAh/LnbrIynYKLCU97iWyH2ahN3gW r2YP5c+/9S45ESxUY4MLWnJ7ZnACxD3S+Y0VZORpFueFk0SWmPL6AO4H5SJyDEaMgzZh MBeBQ11Z+ITV/+Ac1dIdTmfI60hI14udCKUU8o5/MHXgnZ++YE7/s5UJw4rj2UkQJzDF 2bt4hkhASnKURjsdBBdhaBz432989Dw9m+U0ZgWNxieA+hB8gfiQ3afGvZ/woMhStf7O RiFw== X-Gm-Message-State: AMke39mTzbIfJNr9xViy9i28n1KDQqA5SpIGlMFhvizLIYMzi3VIx00o0/ZH5YwDQHlp7w== X-Received: by 10.200.52.196 with SMTP id x4mr10455216qtb.276.1488070527941; Sat, 25 Feb 2017 16:55:27 -0800 (PST) Received: from localhost (c-73-154-132-169.hsd1.pa.comcast.net. [73.154.132.169]) by smtp.gmail.com with ESMTPSA id u6sm7725766qkh.66.2017.02.25.16.55.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Feb 2017 16:55:26 -0800 (PST) From: Brian Ashworth To: Alexander Viro , Andrew Morton , Kees Cook , Arnd Bergmann , Ingo Molnar , Ard Biesheuvel , Andy Lutomirski , Nicolas Pitre , Petr Mladek , Helge Deller , Rik van Riel , Thomas Garnier , Parav Pandit , "seokhoon . yoon" , Thomas Gleixner , Dave Hansen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: josh@joshtriplett.org, brkkurek192@gmail.com, conorcurry@gmail.com, fanofbond138@gmail.com, Brian Ashworth Subject: [PATCH 1/1] fs: Allows for the pivot_root syscall to be optional Date: Sat, 25 Feb 2017 19:54:47 -0500 Message-Id: <06c7c949626acd419d77d611a65ca5427d6cf866.1488054759.git.bosrsf04@gmail.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The pivot_root syscall is not needed on systems that do not use any intermediate filesystem. Allowing for pivot_root to be ommitted from the kernel will aid in the tinification efforts. Without CONFIG_PIVOT_ROOT_SYSCALL set add/remove: 0/2 grow/shrink: 1/0 up/down: 45/-707 (-662) function old new delta attach_recursive_mnt 349 394 +45 attach_mnt 71 - -71 sys_pivot_root 636 - -636 Total: Before=1899893, After=1899231, chg -0.03% Signed-off-by: Brian Ashworth Acked-by: Nicolas Pitre --- fs/namespace.c | 2 ++ init/Kconfig | 10 ++++++++++ kernel/sys_ni.c | 1 + 3 files changed, 13 insertions(+) diff --git a/fs/namespace.c b/fs/namespace.c index 487ba30bb5c6..5e24a08bfb36 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3058,6 +3058,7 @@ bool path_is_under(const struct path *path1, const struct path *path2) } EXPORT_SYMBOL(path_is_under); +#ifdef CONFIG_PIVOT_ROOT_SYSCALL /* * pivot_root Semantics: * Moves the root file system of the current process to the directory put_old, @@ -3180,6 +3181,7 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, out0: return error; } +#endif /* CONFIG_PIVOT_ROOT_SYSCALL */ static void __init init_mount_tree(void) { diff --git a/init/Kconfig b/init/Kconfig index 8c39615165b7..4ea9ab25ec30 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1450,6 +1450,16 @@ config SYSCTL_SYSCALL If unsure say N here. +config PIVOT_ROOT_SYSCALL + bool "Pivot_root syscall support" if EXPERT + default y + help + pivot_root is a system call that allows the root to be moved and + replaced by another root. This is needed for intermediate file + systems such as initrd. + + If unsure say Y here. + config POSIX_TIMERS bool "Posix Clocks & timers" if EXPERT default y diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index 8acef8576ce9..7bd207571f87 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -178,6 +178,7 @@ cond_syscall(sys_setfsgid); cond_syscall(sys_capget); cond_syscall(sys_capset); cond_syscall(sys_copy_file_range); +cond_syscall(sys_pivot_root); /* arch-specific weak syscall entries */ cond_syscall(sys_pciconfig_read);