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

Bug#703746: live-boot: CIFS-backed netboot fails with segfault of mount.cifs



Source: live-boot
Version: 3.0.1-1
Severity: normal
Tags: patch

I'm trying to netboot an x86 system which has multiple NICs, though only
one is recognised by the BIOS/PXE boot firmware and as such the full
netboot process should happen over this interface. The real root image
is hosted on a CIFS share but live-boot fails to mount the share during
early userspace.

The trouble is caused by a segfault of mount.cifs, which I must say is
difficult to debug in early userspace. The mount attempt only seemed to
fail in the live-boot scripts; attempting to mount the filesystem from
the recovery shell provided in early-userspace succeeded. Investigating,
it seems that the mount options as provided to mount.cifs in the
live-boot scripts are at fault in that the option variable is quoted,
including the -o, making it an unexpected argument to mount.cifs.
Arguably mount.cifs should do something better than simply segfault,
however it's still the case that live-boot is not passing the parameters
correctly.

The attached patch simply doesn't quote CIFSOPTS when passing the value
to mount.cifs. This may not be the best approach; a better one might be
to provide -o separate to the CIFSOPTS value. I'm happy to revise the
patch if that's prefered.

The system information provided below isn't terribly relevant, however
having only ever filed a series of Debian bugs in the last 20 minutes
I'm not sure if I should take it out.

-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (650, 'testing'), (600, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.7.2 (SMP w/8 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From 62170921ac5beb81137c0d3d015a56ecdcd9bf5d Mon Sep 17 00:00:00 2001
From: Andrew Jeffery <andrewj@avalon.com.au>
Date: Thu, 21 Mar 2013 15:15:44 +1030
Subject: [PATCH 3/3] CIFS: Don't quote $CIFSOPTS for mount.cifs

Quoting $CIFSOPTS passed the literal string "-o user=root,password=" to
mount.cifs, killing mount.cifs with a SIGSEGV.  Rather, -o should be
properly space delimited by passing $CIFSOPTS unquoted for options to be
parsed correctly.
---
 scripts/boot/9990-mount-cifs.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/boot/9990-mount-cifs.sh b/scripts/boot/9990-mount-cifs.sh
index a8ef3f4..8dd1818 100755
--- a/scripts/boot/9990-mount-cifs.sh
+++ b/scripts/boot/9990-mount-cifs.sh
@@ -10,7 +10,7 @@ do_cifsmount ()
 	then
 		if [ -z "${NFSOPTS}" ]
 		then
-			CIFSOPTS="-ouser=root,password="
+			CIFSOPTS="-o user=root,password="
 		else
 			CIFSOPTS="-o ${NFSOPTS}"
 		fi
@@ -18,7 +18,7 @@ do_cifsmount ()
 		log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
 		modprobe -q cifs
 
-		if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
+		if mount.cifs "${NFSROOT}" "${mountpoint}" ${CIFSOPTS}
 		then
 			rc=0
 		fi
-- 
1.7.10.4


Reply to: