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:   Mon, 7 Feb 2022 13:46:49 -0800
From:   Luis Chamberlain <mcgrof@...nel.org>
To:     Domenico Andreoli <domenico.andreoli@...ux.com>,
        Tong Zhang <ztong0001@...il.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>
Cc:     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, 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,
        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,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix regression due to "fs: move binfmt_misc sysctl to
 its own file"

On Mon, Feb 07, 2022 at 02:27:28PM +0100, Domenico Andreoli wrote:
> 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;
>  }

OK I think the issue here should have been that declaring this on
fs/binfmt_misc.c creates the chicken and the egg issue, and so we
need to do this on built-in code. Instead of your patch can you try
this instead, it just always creates the sysctl mount always now
so long as proc sysctl is enabled. It does not do the unregistration
as we always want the path present as it used to be before as well.

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index c07f35719ee3..4b8f1b11a7c8 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -817,20 +817,16 @@ static struct file_system_type bm_fs_type = {
 };
 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;
 }
 
 static void __exit exit_misc_binfmt(void)
 {
-	unregister_sysctl_table(binfmt_misc_header);
 	unregister_binfmt(&misc_format);
 	unregister_filesystem(&bm_fs_type);
 }
diff --git a/fs/file_table.c b/fs/file_table.c
index 57edef16dce4..4f4739c9405c 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -119,6 +119,7 @@ static struct ctl_table fs_stat_sysctls[] = {
 static int __init init_fs_stat_sysctls(void)
 {
 	register_sysctl_init("fs", fs_stat_sysctls);
+	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