From: Martin Hicks <mort@wildopensource.com>
To: linux-kernel@vger.kernel.org
Subject: pivot_root off an initramfs broken
Date: Wed, 03 Dec 2003 19:04:32 -0500 [thread overview]
Message-ID: <1070496272.8280.443.camel@plato.i.bork.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]
This is the conclusion that I've come to. For background please see:
http://www.zytor.com/pipermail/klibc/2003-November/000223.html
which finishes up here:
http://www.zytor.com/pipermail/klibc/2003-December/000254.html
The executive summary is this:
If I boot a 2.6 kernel that first execs /sbin/kinit on the initramfs,
does some setup (mostly to find the real root filesystem), then
pivot_roots over to the real root filesystem and execs /sbin/init the
kernel spins inside check_mnt() while mounting /proc in the initscripts.
The reason is because the vfsmount structures for the root filesystem
looks like this:
mnt->mnt_devname = /dev/root (this is good)
mnt->mnt_parent->mnt_devname = rootfs (this is good, I think)
mnt->mnt_parent->mnt_parent->mnt_devname = /dev/root (wrong!)
I think it's in pivot_root that something is going wrong.
The attached patch fixes the problem, but is just a hack.
Any comments on how to really fix this?
TIA,
mh
--
Martin Hicks Wild Open Source Inc.
mort@wildopensource.com 613-266-2296
[-- Attachment #2: namespace.diff --]
[-- Type: text/x-patch, Size: 586 bytes --]
===== fs/namespace.c 1.50 vs edited =====
--- 1.50/fs/namespace.c Tue Oct 7 21:52:02 2003
+++ edited/fs/namespace.c Wed Dec 3 18:48:59 2003
@@ -1064,6 +1064,9 @@
detach_mnt(user_nd.mnt, &root_parent);
attach_mnt(user_nd.mnt, &old_nd);
attach_mnt(new_nd.mnt, &root_parent);
+ if (new_nd.mnt == new_nd.mnt->mnt_parent->mnt_parent &&
+ new_nd.mnt != new_nd.mnt->mnt_parent) /* initramfs loop */
+ new_nd.mnt->mnt_parent->mnt_parent = new_nd.mnt->mnt_parent;
spin_unlock(&vfsmount_lock);
chroot_fs_refs(&user_nd, &new_nd);
security_sb_post_pivotroot(&user_nd, &new_nd);
next reply other threads:[~2003-12-04 0:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-04 0:04 Martin Hicks [this message]
2003-12-04 0:30 ` H. Peter Anvin
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=1070496272.8280.443.camel@plato.i.bork.org \
--to=mort@wildopensource.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®