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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 9 Feb 2022 08:49:20 +0100
From:   Domenico Andreoli <domenico.andreoli@...ux.com>
To:     Luis Chamberlain <mcgrof@...nel.org>
Cc:     Tong Zhang <ztong0001@...il.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        David Airlie <airlied@...ux.ie>,
        Andrew Morton <akpm@...ux-foundation.org>, amir73il@...il.com,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Arnd Bergmann <arnd@...db.de>, bcrl@...ck.org,
        benh@...nel.crashing.org, clemens@...isch.de, crope@....fi,
        dgilbert@...erlog.com, Greg KH <gregkh@...uxfoundation.org>,
        jack@...e.cz, jani.nikula@...el.com, jani.nikula@...ux.intel.com,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>, jlbec@...lplan.org,
        john.ogness@...utronix.de, joonas.lahtinen@...ux.intel.com,
        Joseph Qi <joseph.qi@...ux.alibaba.com>, julia.lawall@...ia.fr,
        Kees Cook <keescook@...omium.org>, kernel@...force.de,
        Linux Memory Management List <linux-mm@...ck.org>,
        mark@...heh.com, "Martin K. Petersen" <martin.petersen@...cle.com>,
        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,
        Al Viro <viro@...iv.linux.org.uk>, wangqing@...o.com,
        Iurii Zaikin <yzaikin@...gle.com>,
        open list <linux-kernel@...r.kernel.org>,
        regressions@...ts.linux.dev
Subject: [PATCH v2] 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 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 <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: 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 +-----
 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);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ