[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YfA+SJZrd4nkFSgH@bombadil.infradead.org>
Date: Tue, 25 Jan 2022 10:15:36 -0800
From: Luis Chamberlain <mcgrof@...nel.org>
To: Tong Zhang <ztong0001@...il.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Eric Biederman <ebiederm@...ssion.com>,
Kees Cook <keescook@...omium.org>,
Iurii Zaikin <yzaikin@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Christian Brauner <brauner@...nel.org>
Subject: Re: [PATCH v2 1/2] binfmt_misc: fix crash when load/unload module
On Mon, Jan 24, 2022 at 10:18:12AM -0800, Tong Zhang wrote:
> We should unregister the table upon module unload otherwise something
> horrible will happen when we load binfmt_misc module again. Also note
> that we should keep value returned by register_sysctl_mount_point() and
> release it later, otherwise it will leak.
> Also, per Christian's comment, to fully restore the old behavior that
> won't break userspace the check(binfmt_misc_header) should be
> eliminated.
>
> reproduce:
> modprobe binfmt_misc
> modprobe -r binfmt_misc
> modprobe binfmt_misc
> modprobe -r binfmt_misc
> modprobe binfmt_misc
>
> [ 18.032038] Call Trace:
> [ 18.032108] <TASK>
> [ 18.032169] dump_stack_lvl+0x34/0x44
> [ 18.032273] __register_sysctl_table+0x6f4/0x720
> [ 18.032397] ? preempt_count_sub+0xf/0xb0
> [ 18.032508] ? 0xffffffffc0040000
> [ 18.032600] init_misc_binfmt+0x2d/0x1000 [binfmt_misc]
> [ 18.042520] binfmt_misc: Failed to create fs/binfmt_misc sysctl mount point
> modprobe: can't load module binfmt_misc (kernel/fs/binfmt_misc.ko): Cannot allocate memory
> [ 18.063549] binfmt_misc: Failed to create fs/binfmt_misc sysctl mount point
> [ 18.204779] BUG: unable to handle page fault for address: fffffbfff8004802
>
> Fixes: 3ba442d5331f ("fs: move binfmt_misc sysctl to its own file")
> Co-developed-by: Christian Brauner<brauner@...nel.org>
> Signed-off-by: Tong Zhang <ztong0001@...il.com>
Acked-by: Luis Chamberlain <mcgrof@...nel.org>
Luis
Powered by blists - more mailing lists