From patchwork Wed Feb 9 07:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Domenico Andreoli X-Patchwork-Id: 12739740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 081FFC433EF for ; Wed, 9 Feb 2022 07:49:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C0736B0073; Wed, 9 Feb 2022 02:49:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7707F6B0074; Wed, 9 Feb 2022 02:49:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65EBC6B0075; Wed, 9 Feb 2022 02:49:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id 501ED6B0074 for ; Wed, 9 Feb 2022 02:49:25 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 10918181912C9 for ; Wed, 9 Feb 2022 07:49:25 +0000 (UTC) X-FDA: 79122466290.15.FE9137E Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf20.hostedemail.com (Postfix) with ESMTP id 4B1141C0008; Wed, 9 Feb 2022 07:49:24 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id da4so3364078edb.4; Tue, 08 Feb 2022 23:49:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LUzGldKtZC3jOl6Fq1nfXnQKprYL3pMs6oURDAZ0EmE=; b=KOvrX9K5oGQAb0XaO6VlNj0WKjC9bavJrqO6YBN2wMeYSLTNMMq4OUNbxxQtCKhHDd iu25luITlcqZYE2ZMl8jsIxUQcGUjf1t8MvTEu7cO0V8NYRhxcGzsEpD1e6wWB6KCcEH 0rpvH33A61Wk0zcJSRuAlliDXLG6zwTrSJx00FL4JwfzkkJ/qHVrYtTj2wAsdgoV7TMB hwCCfDzPd1GoWbg0oaynvhMWtw4g/aAxwnqQBwBsnpb/TEI5Xq9aU0rd7fKr1uiirDCK jCmdSG28ZM5umxg0NiSDA5adQqe+DSKSQyEyk5V5cf7WFwgJa3VnWxM/pbluedefgbiC W5bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=LUzGldKtZC3jOl6Fq1nfXnQKprYL3pMs6oURDAZ0EmE=; b=D0Lh0aw0YrBzuV+nSkCD/SN6a7EPGJ6AOKtLHzKQyp6jjlMbk6Ag1EUoEr07g3wQlV mYujuUY0M10gcoyOEpj7NjtfHeZIv6sqo9zUWDCaUoIH4VAYQ05YVw6htSu/Zv8npDgx 3jkDIRGrjncK/SeTUPSYFow7QllgcvCvB73XVwtcIb6gCuri3s6aIjIVTvbdJcQua9G/ yjpcIWZcklC9MhencDNpzZyIek2ong/SI7H3cjI2FRgDmaL5tm05Qr5VTAnWhk8m8f6x maiFuvSpMXHJNnROKDEoLqjlRuBJ4EM4TjsJYd2gkSiGRXp7znxOufReXTItYZiFEPK5 RReg== X-Gm-Message-State: AOAM532aQeoWCZfB1xXyByR9vYZ42q3QGJMFammnHag2pbEPczb1ady+ wo2zki7r+oaKVDB/LJtPDGE= X-Google-Smtp-Source: ABdhPJy7j/jOKxsaAV2/AtzcWda7tM3HPoh6bV/FquZcserdfo9YfUiMeSpCU161wWXwVjfQXLLUEA== X-Received: by 2002:a05:6402:51cd:: with SMTP id r13mr1079014edd.381.1644392962839; Tue, 08 Feb 2022 23:49:22 -0800 (PST) Received: from dumbo ([185.220.101.84]) by smtp.gmail.com with ESMTPSA id l1sm5690964ejb.81.2022.02.08.23.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 23:49:22 -0800 (PST) Received: from cavok by dumbo with local (Exim 4.94.2) (envelope-from ) id 1nHhj6-0002av-MX; Wed, 09 Feb 2022 08:49:20 +0100 Date: Wed, 9 Feb 2022 08:49:20 +0100 From: Domenico Andreoli To: Luis Chamberlain Cc: Tong Zhang , "Eric W. Biederman" , David Airlie , Andrew Morton , amir73il@gmail.com, Andy Shevchenko , Arnd Bergmann , bcrl@kvack.org, benh@kernel.crashing.org, clemens@ladisch.de, crope@iki.fi, dgilbert@interlog.com, Greg KH , jack@suse.cz, jani.nikula@intel.com, jani.nikula@linux.intel.com, "James E.J. Bottomley" , jlbec@evilplan.org, john.ogness@linutronix.de, joonas.lahtinen@linux.intel.com, Joseph Qi , julia.lawall@inria.fr, Kees Cook , kernel@tuxforce.de, Linux Memory Management List , mark@fasheh.com, "Martin K. Petersen" , mm-commits@vger.kernel.org, nixiaoming@huawei.com, penguin-kernel@i-love.sakura.ne.jp, peterz@infradead.org, phil@philpotter.co.uk, pjt@google.com, pmladek@suse.com, rafael@kernel.org, rodrigo.vivi@intel.com, rostedt@goodmis.org, senozhatsky@chromium.org, sre@kernel.org, steve@sk2.org, surenb@google.com, torvalds@linux-foundation.org, tytso@mit.edu, Al Viro , wangqing@vivo.com, Iurii Zaikin , open list , regressions@lists.linux.dev Subject: [PATCH v2] Fix regression due to "fs: move binfmt_misc sysctl to its own file" Message-ID: References: <20220121221021.60533b009c357d660791476e@linux-foundation.org> <20220122061228.nmuo75sDn%akpm@linux-foundation.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam11 X-Rspam-User: X-Stat-Signature: t1pwsqy1sjzk5zmoj818opbpp9emh7o4 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KOvrX9K5; dmarc=none; spf=pass (imf20.hostedemail.com: domain of domenico.andreoli.it@gmail.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=domenico.andreoli.it@gmail.com X-Rspamd-Queue-Id: 4B1141C0008 X-HE-Tag: 1644392964-782826 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Commit 3ba442d5331f did not go unnoticed, binfmt-support stopped to work on my Debian system since v5.17-rc2 (did not check with -rc1). The existance of the /proc/sys/fs/binfmt_misc is a precondition for attempting to mount the binfmt_misc fs, which in turn triggers the autoload of the binfmt_misc module. Without it, no module is loaded and no binfmt is available at boot. Building as built-in or manually loading the module and mounting the fs works fine, it's therefore only a matter of interaction with user-space. I could try to improve the Debian systemd configuration but I can't say anything about the other distributions. This patch restores a working system right after boot. v2: - move creation of fs/binfmt_misc to fs/file_table.c - use IS_ENABLED() to conditionally create it Fixes: 3ba442d5331f ("fs: move binfmt_misc sysctl to its own file") Signed-off-by: Domenico Andreoli Cc: Al Viro Cc: Amir Goldstein Cc: Andrew Morton Cc: Andy Shevchenko Cc: Antti Palosaari Cc: Arnd Bergmann Cc: Benjamin Herrenschmidt Cc: Benjamin LaHaise Cc: Clemens Ladisch Cc: David Airlie Cc: Douglas Gilbert Cc: Eric Biederman Cc: Greg Kroah-Hartman Cc: Iurii Zaikin Cc: James E.J. Bottomley Cc: Jan Kara Cc: Jani Nikula Cc: Jani Nikula Cc: Joel Becker Cc: John Ogness Cc: Joonas Lahtinen Cc: Joseph Qi Cc: Julia Lawall Cc: Kees Cook Cc: Lukas Middendorf Cc: Mark Fasheh Cc: Martin K. Petersen Cc: Paul Turner Cc: Peter Zijlstra Cc: Petr Mladek Cc: Phillip Potter Cc: Qing Wang Cc: "Rafael J. Wysocki" Cc: Rodrigo Vivi Cc: Sebastian Reichel Cc: Sergey Senozhatsky Cc: Stephen Kitt Cc: Steven Rostedt (VMware) Cc: Suren Baghdasaryan Cc: Tetsuo Handa Cc: "Theodore Ts'o" Cc: Xiaoming Ni Reviewed-by: Tong Zhang --- fs/binfmt_misc.c | 6 +----- fs/file_table.c | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) Index: b/fs/binfmt_misc.c =================================================================== --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -817,20 +817,16 @@ static struct file_system_type bm_fs_typ }; MODULE_ALIAS_FS("binfmt_misc"); -static struct ctl_table_header *binfmt_misc_header; - static int __init init_misc_binfmt(void) { int err = register_filesystem(&bm_fs_type); if (!err) insert_binfmt(&misc_format); - binfmt_misc_header = register_sysctl_mount_point("fs/binfmt_misc"); - return 0; + return err; } static void __exit exit_misc_binfmt(void) { - unregister_sysctl_table(binfmt_misc_header); unregister_binfmt(&misc_format); unregister_filesystem(&bm_fs_type); } Index: b/fs/file_table.c =================================================================== --- a/fs/file_table.c +++ b/fs/file_table.c @@ -119,6 +119,8 @@ static struct ctl_table fs_stat_sysctls[ static int __init init_fs_stat_sysctls(void) { register_sysctl_init("fs", fs_stat_sysctls); + if (IS_ENABLED(CONFIG_BINFMT_MISC)) + register_sysctl_mount_point("fs/binfmt_misc"); return 0; } fs_initcall(init_fs_stat_sysctls);