kvm -initrd 'file' dumps core if 'file' does not exist

Bug #619302 reported by Scott Moser
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
qemu-kvm (Ubuntu)
Fix Released
Low
Thierry Carrez

Bug Description

Binary package hint: qemu-kvm

The following crashes
$ k=/boot/vmlinuz-$(uname -r)
$ i=does-not-exist
$ rm -f ${i}
$ qemu-img create disk.img 1G
$ kvm -kernel ${k} -initrd ${i} -hda disk.img
Aborted (core dumped)

Note the difference from if kernel doesn't exist:
$ kvm -kernel ${i}
qemu: could not load kernel 'does-not-exist': No such file or directory

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: kvm (not installed)
ProcVersionSignature: Ubuntu 2.6.35-14.20-generic 2.6.35
Uname: Linux 2.6.35-14-generic x86_64
Architecture: amd64
Date: Tue Aug 17 11:19:19 2010
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Beta amd64 (20100318)
KvmCmdLine: Error: command ['ps', '-C', 'kvm', '-F'] failed with exit code 1: UID PID PPID C SZ RSS PSR STIME TTY TIME CMD
MachineType: LENOVO 7417CTO
PccardctlIdent:
 Socket 0:
   no product info available
PccardctlStatus:
 Socket 0:
   no card
ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.35-14-generic root=UUID=36286167-4eba-4a1e-a202-155c6baafa01 ro quiet splash
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: qemu-kvm
dmi.bios.date: 04/17/2009
dmi.bios.vendor: LENOVO
dmi.bios.version: 7UET70WW (3.00 )
dmi.board.name: 7417CTO
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr7UET70WW(3.00):bd04/17/2009:svnLENOVO:pn7417CTO:pvrThinkPadT400:rvnLENOVO:rn7417CTO:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 7417CTO
dmi.product.version: ThinkPad T400
dmi.sys.vendor: LENOVO

Related branches

Revision history for this message
Scott Moser (smoser) wrote :
Mathias Gug (mathiaz)
Changed in qemu-kvm (Ubuntu):
importance: Undecided → Low
Revision history for this message
Nigel Jones (dev-nigelj) wrote :

I've done a bit of digging here:

I encounter the issue in both Lucid and Maverick.

gdb on the generated core, w/ a 'bt' shows:

<snip>
#2 0x000000000046f2c5 in oom_check (size=<value optimised out>)
    at qemu-malloc.c:30
#3 qemu_malloc (size=<value optimised out>) at qemu-malloc.c:59
#4 0x000000000044a616 in load_linux (fw_cfg=0x275e060,
    kernel_filename=<value optimised out>,
    initrd_filename=0x7fff8a0e45d5 "baabaablacksheep",
    kernel_cmdline=<value optimised out>, max_ram_size=<value optimised out>)
    at /build/buildd/qemu-kvm-0.12.3+noroms/hw/pc.c:876
<snip>

hw/pc.c:876 is an attempt to allocate memory for the size of the initrd, the function that calculates the size of the initrd returns '-1' if the file doesn't exist.

Upstream have patched it though to check for an initrd size of -1 and I'm in the process of grabbing the particular change and getting as a diff that could be applied.

Revision history for this message
Nigel Jones (dev-nigelj) wrote :

Upstream have fixed this in commit d6fa4b77fb8f27ac84cf23fb1e15016673d98a47

Which I have modified for what we currently have in Lucid & Maverick, the patch seems to apply cleanly.

Tested with Maverick already and seems to be fine.

tags: added: patch
Nigel Jones (dev-nigelj)
Changed in qemu-kvm (Ubuntu):
status: New → Confirmed
Thierry Carrez (ttx)
Changed in qemu-kvm (Ubuntu):
assignee: nobody → Thierry Carrez (ttx)
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qemu-kvm - 0.12.5+noroms-0ubuntu5

---------------
qemu-kvm (0.12.5+noroms-0ubuntu5) maverick; urgency=low

  * Apply patch to fix the lack of error checking when opening
    an initrd file. (LP: #619302)
 -- Serge Hallyn <email address hidden> Mon, 30 Aug 2010 12:49:47 -0500

Changed in qemu-kvm (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.