Re: mainline-5.5.0-rc1: do_mount_root+0x6c/0x10d - kernel crash while mounting rootfs
From: Dominik Brodowski
Date: Mon Dec 16 2019 - 06:24:44 EST
On Mon, Dec 16, 2019 at 11:22:04AM +0100, Arnd Bergmann wrote:
> On Mon, Dec 16, 2019 at 10:15 AM Naresh Kamboju
> <naresh.kamboju@xxxxxxxxxx> wrote:
> >
> > The following kernel crash reported on qemu_x86_64 boot running
> > 5.5.0-rc1 mainline kernel.
>
> I looked for too long at v5.5-rc1 completely puzzled by how you got to this
> object code before realizing that this is a git snapshot between -rc1 and -rc2.
>
> The code in question was changed by a recent series from Dominik Brodowski,
> the main difference being commit cccaa5e33525 ("init: use do_mount() instead
> of ksys_mount()").
>
> It looks like the NULL-check in ksys_mount()/copy_mount_options() is missing
> from the new mount_block_root, so it passes a NULL pointer into strncpy().
>
> Something like this should fix it (not tested):
This equivalent patch by Linus already got some testing:
https://lore.kernel.org/lkml/CAHk-=wh8VLe3AEKhz=1bzSO=1fv4EM71EhufxuC=Gp=+bLhXoA@xxxxxxxxxxxxxx/
Thanks,
Dominik