Skip to content

Commit b42bc9a

Browse files
cavokztorvalds
authored andcommitted
Fix regression due to "fs: move binfmt_misc sysctl to its own file"
Commit 3ba442d ("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: 3ba442d ("fs: move binfmt_misc sysctl to its own file") Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: Tong Zhang <ztong0001@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 09a93c1 commit b42bc9a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

fs/binfmt_misc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -817,20 +817,16 @@ static struct file_system_type bm_fs_type = {
817817
};
818818
MODULE_ALIAS_FS("binfmt_misc");
819819

820-
static struct ctl_table_header *binfmt_misc_header;
821-
822820
static int __init init_misc_binfmt(void)
823821
{
824822
int err = register_filesystem(&bm_fs_type);
825823
if (!err)
826824
insert_binfmt(&misc_format);
827-
binfmt_misc_header = register_sysctl_mount_point("fs/binfmt_misc");
828-
return 0;
825+
return err;
829826
}
830827

831828
static void __exit exit_misc_binfmt(void)
832829
{
833-
unregister_sysctl_table(binfmt_misc_header);
834830
unregister_binfmt(&misc_format);
835831
unregister_filesystem(&bm_fs_type);
836832
}

fs/file_table.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ static struct ctl_table fs_stat_sysctls[] = {
119119
static int __init init_fs_stat_sysctls(void)
120120
{
121121
register_sysctl_init("fs", fs_stat_sysctls);
122+
if (IS_ENABLED(CONFIG_BINFMT_MISC))
123+
register_sysctl_mount_point("fs/binfmt_misc");
122124
return 0;
123125
}
124126
fs_initcall(init_fs_stat_sysctls);

0 commit comments

Comments
 (0)