mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Poetzl <herbert@13thfloor.at>
To: linux-kernel@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Bernd Eckenfels <ecki@calista.eckenfels.6bone.ka-ip.net>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: 2.4.21 Floppy Fallback with NFS root ...
Date: Thu, 19 Jun 2003 18:03:14 +0200	[thread overview]
Message-ID: <20030619160314.GA27584@www.13thfloor.at> (raw)
In-Reply-To: <20030616141832.GG23590@www.13thfloor.at>


on a deeper look at this issue, another astounding
(read confusing, erroneous) detail was revealed ...

consider a kernel boot cmdline like

  "root=/dev/vg/slash ro"

which could be used to boot from a LVM LV named slash
or, if you prefer a physical device (using devfs)

  "root=/dev/ide//host0/bus0/target0/lun0/part1 ro"


now what happens on boot is:

root_dev_setup() is called with "root=" and, in turn
calls name_to_kdev_t() which searches root_dev_names[]
for the given device names, which of course, can not
be found, because they are not listed, so ROOT_DEV
becomes (0:0)
 
if you have CONFIG_ROOT_NFS enabled, then mount_root()
will check if MAJOR(ROOT_DEV) == UNNAMED_MAJOR, which
will be true, although root=/dev/nfs (0:ff) wasn't 
specified, leading directly to "Unable to mount root 
fs via NFS, trying floppy." and the Floppy Fallback, 
instead of booting from your specified root device.

  "root=/dev/hda1 ro"

will work as expected, because it will be found in
root_dev_names[] ...


I suggest to do one fix, and one improvement ...

and of course this _will_ break the current behaviour
you won't be able to use root=tux (or your favorite
pet name) to have root on nfs ...

what do you think?

best,
Herbert


------------------ FIX

diff -NurbP --minimal linux-2.4.21/init/do_mounts.c linux-2.4.21-ffb/init/do_mounts.c
--- linux-2.4.21/init/do_mounts.c	Fri Jun 13 17:49:28 2003
+++ linux-2.4.21-ffb/init/do_mounts.c	Thu Jun 19 17:41:35 2003
@@ -747,7 +747,8 @@
 static void __init mount_root(void)
 {
 #ifdef CONFIG_ROOT_NFS
-	if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
+	if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR
+	    && MINOR(ROOT_DEV) == 255) {
 		if (mount_nfs_root()) {
 			sys_chdir("/root");
 			ROOT_DEV = current->fs->pwdmnt->mnt_sb->s_dev;


maybe a NFS_MAJOR, NFS_MINOR would be more descriptive here ...


------------------ SECURITY IMPROVEMENT ;)

diff -NurbP --minimal linux-2.4.21/fs/Config.in linux-2.4.21-ffb/fs/Config.in
--- linux-2.4.21/fs/Config.in	Tue Dec 10 03:25:19 2002
+++ linux-2.4.21-ffb/fs/Config.in	Thu Jun 19 17:42:35 2003
@@ -103,6 +103,7 @@
    dep_tristate 'NFS file system support' CONFIG_NFS_FS $CONFIG_INET
    dep_mbool '  Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS
    dep_bool '  Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS $CONFIG_IP_PNP
+   dep_bool '    Disable Floppy Fallback' CONFIG_NO_FLOPPY_FALLBACK $CONFIG_ROOT_NFS
 
    dep_tristate 'NFS server support' CONFIG_NFSD $CONFIG_INET
    dep_mbool '  Provide NFSv3 server support' CONFIG_NFSD_V3 $CONFIG_NFSD
diff -NurbP --minimal linux-2.4.21/init/do_mounts.c linux-2.4.21-ffb/init/do_mounts.c
--- linux-2.4.21/init/do_mounts.c	Fri Jun 13 17:49:28 2003
+++ linux-2.4.21-ffb/init/do_mounts.c	Thu Jun 19 17:41:35 2003
@@ -754,8 +754,10 @@
 			printk("VFS: Mounted root (nfs filesystem).\n");
 			return;
 		}
+# ifndef CONFIG_NO_FLOPPY_FALLBACK
 		printk(KERN_ERR "VFS: Unable to mount root fs via NFS, trying floppy.\n");
 		ROOT_DEV = MKDEV(FLOPPY_MAJOR, 0);
+# endif
 	}
 #endif
 	devfs_make_root(root_device_name);




  parent reply	other threads:[~2003-06-19 15:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-16 14:18 Herbert Poetzl
2003-06-17 15:11 ` Pavel Machek
2003-06-17 15:40   ` Herbert Poetzl
2003-06-17 16:58   ` Bernd Eckenfels
2003-06-19 16:03 ` Herbert Poetzl [this message]
2003-06-17 16:29 John Bradford

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=20030619160314.GA27584@www.13thfloor.at \
    --to=herbert@13thfloor.at \
    --cc=ecki@calista.eckenfels.6bone.ka-ip.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rusty@rustcorp.com.au \
    /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®