Commit b42bc9a3 authored by Domenico Andreoli's avatar Domenico Andreoli Committed by Linus Torvalds

Fix regression due to "fs: move binfmt_misc sysctl to its own file"

Commit 3ba442d5 ("fs: move binfmt_misc sysctl to its own file") 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.

Fixes: 3ba442d5 ("fs: move binfmt_misc sysctl to its own file")
Signed-off-by: default avatarDomenico Andreoli <domenico.andreoli@linux.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: default avatarTong Zhang <ztong0001@gmail.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 09a93c1d
...@@ -817,20 +817,16 @@ static struct file_system_type bm_fs_type = { ...@@ -817,20 +817,16 @@ static struct file_system_type bm_fs_type = {
}; };
MODULE_ALIAS_FS("binfmt_misc"); MODULE_ALIAS_FS("binfmt_misc");
static struct ctl_table_header *binfmt_misc_header;
static int __init init_misc_binfmt(void) static int __init init_misc_binfmt(void)
{ {
int err = register_filesystem(&bm_fs_type); int err = register_filesystem(&bm_fs_type);
if (!err) if (!err)
insert_binfmt(&misc_format); insert_binfmt(&misc_format);
binfmt_misc_header = register_sysctl_mount_point("fs/binfmt_misc"); return err;
return 0;
} }
static void __exit exit_misc_binfmt(void) static void __exit exit_misc_binfmt(void)
{ {
unregister_sysctl_table(binfmt_misc_header);
unregister_binfmt(&misc_format); unregister_binfmt(&misc_format);
unregister_filesystem(&bm_fs_type); unregister_filesystem(&bm_fs_type);
} }
......
...@@ -119,6 +119,8 @@ static struct ctl_table fs_stat_sysctls[] = { ...@@ -119,6 +119,8 @@ static struct ctl_table fs_stat_sysctls[] = {
static int __init init_fs_stat_sysctls(void) static int __init init_fs_stat_sysctls(void)
{ {
register_sysctl_init("fs", fs_stat_sysctls); register_sysctl_init("fs", fs_stat_sysctls);
if (IS_ENABLED(CONFIG_BINFMT_MISC))
register_sysctl_mount_point("fs/binfmt_misc");
return 0; return 0;
} }
fs_initcall(init_fs_stat_sysctls); fs_initcall(init_fs_stat_sysctls);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment