qemu fails to set hdd serial number

Bug #584143 reported by Michael Tokarev
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned
qemu-kvm (Debian)
Fix Released
Unknown
qemu-kvm (Ubuntu)
Fix Released
Medium
Serge Hallyn

Bug Description

=========================================
SRU Justification:
1. Impact: 'qemu -drive ...,serial=xyz' does not work
2. How addressed: a patch from upstream fixes bug that sizeof was called on the wrong thing.
3. patch: is in the description
4. to reproduce: use '-drive ...,serial=xyz' option to qemu
5. regression potential: this only changes one line which called sizeof on the wrong thing, so should not impact any other code.
=========================================

The -drive ...,serial=xyz option is broken, at least in 0.12. See Debian bug#573439, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=573439 for details.

The proposed fix from the original reporter:

--- qemu-kvm-0.12.3+dfsg/vl.c 2010-02-26 11:34:00.000000000 +0900
+++ qemu-kvm-0.12.3+dfsg.old/vl.c 2010-03-11 02:26:00.134217787 +0900
@@ -2397,7 +2397,7 @@
     dinfo->on_write_error = on_write_error;
     dinfo->opts = opts;
     if (serial)
- strncpy(dinfo->serial, serial, sizeof(serial));
+ strncpy(dinfo->serial, serial, sizeof(dinfo->serial));
     QTAILQ_INSERT_TAIL(&drives, dinfo, next);
     if (is_extboot) {
         extboot_drive = dinfo;

Revision history for this message
Loïc Minier (lool) wrote :

Patch still applies on top of qemu-kvm.git and qemu.git

Revision history for this message
C de-Avillez (hggdh2) wrote :

Marking Triaged/Medium. Debian has accepted the patch, and a new (patched) package is in Unstable. May be considered for SRU-ing into 10.04 LTS, so nominating.

Changed in qemu-kvm (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Luiz Capitulino (lcapitulino) wrote :

Bug exists in both current master and stable v0.12.4, but the suggested fix doesn't leave room for the null terminating byte, will submit upstream a better version.

Changed in qemu:
status: New → In Progress
Changed in qemu-kvm (Ubuntu Lucid):
status: New → Confirmed
Revision history for this message
Коренберг Марк (socketpair) wrote :

-drive file=/dev/mmwork/testl7,if=ide,index=0,boot=on,format=raw,serial=WD-WMAM9TD73523,cache=writeback

Yeah, bug exists. only WD-W serial is seen inside VM.

Aurelien Jarno (aurel32)
Changed in qemu:
status: In Progress → Fix Committed
Aurelien Jarno (aurel32)
Changed in qemu:
status: Fix Committed → Fix Released
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Patch with fix is at http://patchwork.ozlabs.org/patch/77142/mbox/. It is in 0.14.0 so marked natty bug as fix released. I will propose merge of the fix for maverick and lucid.

Changed in qemu-kvm (Ubuntu):
assignee: nobody → Serge Hallyn (serge-hallyn)
status: Triaged → Fix Released
Changed in qemu-kvm (Ubuntu Lucid):
assignee: nobody → Serge Hallyn (serge-hallyn)
Changed in qemu-kvm (Ubuntu Maverick):
assignee: nobody → Serge Hallyn (serge-hallyn)
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :
Changed in qemu-kvm (Ubuntu Maverick):
status: New → In Progress
Changed in qemu-kvm (Ubuntu Lucid):
status: Confirmed → In Progress
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Please test the packages uploaded in comment #6 (or, if you're on maverick, comment #7) and comment if they work for you. Once verified we can merge the linked bzr trees.

description: updated
tags: added: verification-needed
Changed in qemu-kvm (Debian):
status: Unknown → Fix Released
no longer affects: qemu-kvm (Ubuntu Lucid)
no longer affects: qemu-kvm (Ubuntu Maverick)
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.