Re: [PATCH 3/5] init: use do_mount() instead of ksys_mount()

From: Dominik Brodowski
Date: Mon Dec 16 2019 - 04:51:41 EST


On Mon, Dec 16, 2019 at 10:45:56AM +0100, Borislav Petkov wrote:
> On Thu, Dec 12, 2019 at 07:14:20PM +0100, Dominik Brodowski wrote:
> > diff --git a/init/do_mounts.c b/init/do_mounts.c
> > index 43f6d098c880..f55cbd9cb818 100644
> > --- a/init/do_mounts.c
> > +++ b/init/do_mounts.c
> > @@ -387,12 +387,25 @@ static void __init get_fs_names(char *page)
> > *s = '\0';
> > }
> >
> > -static int __init do_mount_root(char *name, char *fs, int flags, void *data)
> > +static int __init do_mount_root(const char *name, const char *fs,
> > + const int flags, const void *data)
> > {
> > struct super_block *s;
> > - int err = ksys_mount(name, "/root", fs, flags, data);
> > - if (err)
> > - return err;
> > + char *data_page;
> > + struct page *p;
> > + int ret;
> > +
> > + /* do_mount() requires a full page as fifth argument */
> > + p = alloc_page(GFP_KERNEL);
> > + if (!p)
> > + return -ENOMEM;
> > +
> > + data_page = page_address(p);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> That doesn't work in my guest as it gives a funny address:
>
> [ 3.155314] mount_block_root: entry
> [ 3.155868] mount_block_root: fs_name: [ext3]
> [ 3.156512] do_mount_root: will copy data page: 0x00000000adf0ddb8
>
> leading to the splat below.

Does

https://lore.kernel.org/lkml/CAHk-=wh8VLe3AEKhz=1bzSO=1fv4EM71EhufxuC=Gp=+bLhXoA@xxxxxxxxxxxxxx/

solve the issue?

Thanks,
Dominik