lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgEeQNdgBuHRyEWl@dumbo>
Date:   Mon, 7 Feb 2022 14:27:28 +0100
From:   Domenico Andreoli <domenico.andreoli@...ux.com>
To:     airlied@...ux.ie, akpm@...ux-foundation.org, amir73il@...il.com,
        andriy.shevchenko@...ux.intel.com, arnd@...db.de, bcrl@...ck.org,
        benh@...nel.crashing.org, clemens@...isch.de, crope@....fi,
        dgilbert@...erlog.com, ebiederm@...ssion.com,
        gregkh@...uxfoundation.org, jack@...e.cz, jani.nikula@...el.com,
        jani.nikula@...ux.intel.com, jejb@...ux.ibm.com,
        jlbec@...lplan.org, john.ogness@...utronix.de,
        joonas.lahtinen@...ux.intel.com, joseph.qi@...ux.alibaba.com,
        julia.lawall@...ia.fr, keescook@...omium.org, kernel@...force.de,
        linux-mm@...ck.org, mark@...heh.com, martin.petersen@...cle.com,
        mcgrof@...nel.org, mm-commits@...r.kernel.org,
        nixiaoming@...wei.com, penguin-kernel@...ove.sakura.ne.jp,
        peterz@...radead.org, phil@...lpotter.co.uk, pjt@...gle.com,
        pmladek@...e.com, rafael@...nel.org, rodrigo.vivi@...el.com,
        rostedt@...dmis.org, senozhatsky@...omium.org, sre@...nel.org,
        steve@....org, surenb@...gle.com, torvalds@...ux-foundation.org,
        tytso@....edu, viro@...iv.linux.org.uk, wangqing@...o.com,
        yzaikin@...gle.com
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH] Fix regression due to "fs: move binfmt_misc sysctl to its
 own file"

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 /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.

In the meanwhile this patch restores a working system right after boot.

Fixes: 3ba442d5331f ("fs: move binfmt_misc sysctl to its own file")
Signed-off-by: Domenico Andreoli <domenico.andreoli@...ux.com>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Amir Goldstein <amir73il@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Antti Palosaari <crope@....fi>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Benjamin LaHaise <bcrl@...ck.org>
Cc: Clemens Ladisch <clemens@...isch.de>
Cc: David Airlie <airlied@...ux.ie>
Cc: Douglas Gilbert <dgilbert@...erlog.com>
Cc: Eric Biederman <ebiederm@...ssion.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Iurii Zaikin <yzaikin@...gle.com>
Cc: James E.J. Bottomley <jejb@...ux.ibm.com>
Cc: Jan Kara <jack@...e.cz>
Cc: Jani Nikula <jani.nikula@...el.com>
Cc: Jani Nikula <jani.nikula@...ux.intel.com>
Cc: Joel Becker <jlbec@...lplan.org>
Cc: John Ogness <john.ogness@...utronix.de>
Cc: Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>
Cc: Joseph Qi <joseph.qi@...ux.alibaba.com>
Cc: Julia Lawall <julia.lawall@...ia.fr>
Cc: Kees Cook <keescook@...omium.org>
Cc: Lukas Middendorf <kernel@...force.de>
Cc: Luis Chamberlain <mcgrof@...nel.org>
Cc: Mark Fasheh <mark@...heh.com>
Cc: Martin K. Petersen <martin.petersen@...cle.com>
Cc: Paul Turner <pjt@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Petr Mladek <pmladek@...e.com>
Cc: Phillip Potter <phil@...lpotter.co.uk>
Cc: Qing Wang <wangqing@...o.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Rodrigo Vivi <rodrigo.vivi@...el.com>
Cc: Sebastian Reichel <sre@...nel.org>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Stephen Kitt <steve@....org>
Cc: Steven Rostedt (VMware) <rostedt@...dmis.org>
Cc: Suren Baghdasaryan <surenb@...gle.com>
Cc: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: "Theodore Ts'o" <tytso@....edu>
Cc: Xiaoming Ni <nixiaoming@...wei.com>

---
 fs/binfmt_misc.c |    6 +-----
 kernel/sysctl.c  |   13 +++++++++++++
 2 files changed, 14 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/kernel/sysctl.c
===================================================================
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2806,6 +2806,17 @@ static struct ctl_table vm_table[] = {
 	{ }
 };
 
+static struct ctl_table fs_table[] = {
+#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
+	{
+		.procname	= "binfmt_misc",
+		.mode		= 0555,
+		.child		= sysctl_mount_point,
+	},
+#endif
+	{ }
+};
+
 static struct ctl_table debug_table[] = {
 #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
 	{
@@ -2825,6 +2836,7 @@ static struct ctl_table dev_table[] = {
 
 DECLARE_SYSCTL_BASE(kernel, kern_table);
 DECLARE_SYSCTL_BASE(vm, vm_table);
+DECLARE_SYSCTL_BASE(fs, fs_table);
 DECLARE_SYSCTL_BASE(debug, debug_table);
 DECLARE_SYSCTL_BASE(dev, dev_table);
 
@@ -2832,6 +2844,7 @@ int __init sysctl_init_bases(void)
 {
 	register_sysctl_base(kernel);
 	register_sysctl_base(vm);
+	register_sysctl_base(fs);
 	register_sysctl_base(debug);
 	register_sysctl_base(dev);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ