From: Richard Weinberger <richard@nod.at>
To: Dave Reisner <d@falconindy.com>
Cc: Karel Zak <kzak@redhat.com>, util-linux@vger.kernel.org
Subject: Re: [PATCH] [RFC] switch_root: Add a sanity check
Date: Wed, 13 Feb 2013 16:03:48 +0100 [thread overview]
Message-ID: <20130213160348.026682b7@spider.haslach.nod.at> (raw)
In-Reply-To: <20130213145246.GR594@rampage>
Am Wed, 13 Feb 2013 09:52:46 -0500
schrieb Dave Reisner <d@falconindy.com>:
> 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
prev parent reply other threads:[~2013-02-13 15:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-09 18:22 [PATCH] [RFC] switch_root: Add a sanity check Richard Weinberger
2013-02-13 14:25 ` Karel Zak
2013-02-13 14:52 ` Dave Reisner
2013-02-13 15:03 ` Richard Weinberger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130213160348.026682b7@spider.haslach.nod.at \
--to=richard@nod.at \
--cc=d@falconindy.com \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox