Re: [PATCH] [RFC] switch_root: Add a sanity check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Wed, 13 Feb 2013 09:52:46 -0500
schrieb Dave Reisner <d@xxxxxxxxxxxxxx>:

> On Wed, Feb 13, 2013 at 03:25:36PM +0100, Karel Zak wrote:
> > On Sat, Feb 09, 2013 at 07:22:50PM +0100, Richard Weinberger wrote:
> > > As switch_root basically does rm -Rf / we should make sure
> > > that / is really an initramfs.
> > 
> > Oh, nice (we should not ask for details, right? :-) Applied, thanks.
> > 
> >     Karel
> > 
> 
> Wouldn't it be better to check that / is tmpfs or ramfs instead of
> insistence on being a very specific device?

Not really.

switch_root is designed for initramfs only, so the check against
tmpfs is useless.
We can identify an initramfs only because it is the very first mounted
filesystem. The kernel mounts it as rootfs very early, see
fs/namespace.c
So the device 0,1 allows us to identify initramfs nicely.

Checking against type ramfs does not make much sense. It would allow
false positives, If someone overmounted / with an ramfs (or
even tmpfs) then there is no need at all to use switch_root, just use
pivot_root.

Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux