Re: [PATCH RESEND] init/initramfs.c: make initramfs support pivot_root
From: Menglong Dong
Date: Tue May 25 2021 - 02:09:30 EST
On Tue, May 25, 2021 at 9:43 AM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote:
> > This change seems transparent to users, which don't change the behavior
> > of initramfs.
> Are we sure there nothing in the kernel that can regress with this
> change? Are you sure? How sure?
> > However, it seems more reasonable to make it a kconfig option.
> > I'll do it in the v2 of the three patches I sended.
> I'm actually quite convinced now this is a desirable default *other*
> than the concern if this could regress. I recently saw some piece of
> code fetching for the top most mount, I think it was on the
> copy_user_ns() path or something like that, which made me just
> consider possible regressions for heuristics we might have forgotten
> I however have't yet had time to review the path I was concerned for
Yeah, I'm sure...probably. The way I create and mount 'user root' is
almost the same to block root device. When it comes to block
device, such as hda, what kernel do is:
/* This will mount block device on '/root' and chdir to '/root' */
/* This will move the block device mounted on '/root' to '/' */
init_mount(".", "/", NULL, MS_MOVE, NULL);
/* This will change the root to current dir, which is the root of block
And these steps are exactly what I do with 'user root'. However, I'm
not totally sure. For safety, I'll make it into a kconfig option. Is
it acceptable to make it enabled by default?