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

Bug#679377: Segmentation fault when initramfs is booting



Hi

On Wednesday 04 July 2012, Michael Tokarev wrote:
[…]
> On 28.06.2012 13:14, Jordi Pujol wrote:
[…] 
> > the patch "shell-ash-export-HOME.patch" causes a segmentation fault when 
> > initramfs boots,
> > I believe that this fault occurs the first time that initramfs looks for some 
> > executable in the initramfs filesystem,
> 
> Does whole thing actually work?  Why do you think it is this patch
> which causes the SIGSEGV?  The change in this patch is quite, well,
> innocent, it does not look like it can be a cause for any such issues.

I'm having trouble with the same problem in a custom (not Debian live)
live boot environment, where busybox awk segfaults with 
shell-ash-export-HOME.patch applied. The code in question is[1]:

FINGERED=$(awk -F: '
	$1 == "drive name" && NF > 1 {
		split($2, node, " ")
		for (n in node) {
			if (!system("test -b /dev/" node[n]))
				cdrom[i++] = "/dev/" node[n]
		}
	}
	END {
		for (c in cdrom)
			print cdrom[c]
	}
' /proc/sys/dev/cdrom/info)

Leading to:

Loading, please wait...
modprobe: module unix not found in modules.dep
mdadm: No arrays found in config file or automatically
Segmentation fault
Waiting for up to 30s for devices to settle...
Segmentation fault
Segmentation fault
Segmentation fault
Segmentation fault
Segmentation fault
Segmentation fault
Segmentation fault
Segmentation fault
Segmentation fault
Segmentation fault
Failed to detect live media
modprobe: module i8042 not found in modules.dep
modprobe: module atkbd not found in modules.dep


BusyBox v1.20.1 (Debian 1:1.20.0-4) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
(initramfs)


Executing the very same awk command from the initramfs shell (busybox 
ash) afterwards succeeds however:

(initramfs) FINGERED=$(awk -F: '
> $1 == "drive name" && NF > 1 {
> split($2, node, " ")
> for (n in node) {
> if (!system("test -b /dev/" node[n]))
> cdrom[i++] = "/dev/" node[n]
> }
> }
> END {
> for (c in cdrom)
> print cdrom[c]
> }
> ' /proc/sys/dev/cdrom/info)
(initramfs) echo $FINGERED
/dev/sr0

Likewise rewriting the /proc/sys/dev/cdrom/info parsing to use 
different busybox applets succeeds as well, while using awk in 
different functions (fll_meminfo() and fll_copy_with_perc()) segfaults 
the same way.

> Can you describe your initramfs/environment a bit?  Maybe give me
> access to your initramfs for testing?

I'll provide a link to a test environment in a (private) follow up 
mail, using this live code. While this particular initramfs hook is 
not packaged in Debian, I expect similar issues to arise with standard
Debian initramfs hooks.

> > Also, the latest release of busybox, 1.20.1 is a bit different of that, and 
> 
> Different of what, exactly?  The version of busybox you're
> filing bugreport against is actually 1.20.1, so there are
> two questions actually: what is different, and different
> between what and what? -- since you're comparing the same
> thing with itself.
[…]

For testing purposes, I've rebuilt busybox (1:1.20.0-4) with only
shell-ash-export-HOME.patch disabled:

--- busybox-1.20.0/debian/patches/series
+++ busybox-1.20.0/debian/patches/series
@@ -1,6 +1,6 @@
 1.20.1.patch
 
-shell-ash-export-HOME.patch
+#shell-ash-export-HOME.patch
 # we need to get rid of this one:
 #applets-fallback.patch
 version.patch

and the segfaults in busybox awk vanished.

Regards
	Stefan Lippers-Hollmann

[1]	http://svn.berlios.de/svnroot/repos/fullstory/fll-live-initramfs/trunk/scripts/fll

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: