Re: [PATCH v2 2/3] init/do_cmounts.c: introduce 'user_root' for initramfs

From: Menglong Dong
Date: Thu May 27 2021 - 03:30:07 EST


On Wed, May 26, 2021 at 5:03 PM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote:
>
[...]
>
> I asked for the kconfig entry. And it would be good to document then

Wow, I didn't recognize it's you, haha~

> also the worst case expected on boot for what this could do to you. I
> mean, we are opening a different evil universe. So that's why the
> kconfig exists. How bad and evil can this be?

I just dig into it a little deeper today. Except the boot time you
mentioned, I haven't dig out other bad case yet.

I don't think this will affect the path lookup you mentioned before.
As I know, all threads in kernel are using the same root, and after
change root to 'user root', path lookup will be inside this root.

One thing, the name of the root mount will change from 'rootfs' to 'tmpfs'
or 'ramfs'. Before this change, what you can see with 'mount' is:

$ mount
rootfs on / type rootfs (rw,size=903476k,nr_inodes=225869)

After this patch, it will become:

$ mount
tmpfs on / type tmpfs (rw,size=903476k,nr_inodes=225869)

I'm not sure if this is a risk. And I tried to change pivot_root to make
it support the root that have not a parent mount, but not success yet.
That seems much more complex.

Thanks!
Menglong Dong