Bug 726300

Summary: "block_passwd" command does not function well
Product: Red Hat Enterprise Linux 6 Reporter: Qunfang Zhang <qzhang>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 6.2CC: bcao, juzhang, michen, mkenneth, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-12 09:07:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Qunfang Zhang 2011-07-28 06:26:10 UTC
Description of problem:
Create a qcow2 block and with "-o encryption" option. Boot a guest and attach the disk. Then change the disk password by "block_passwd" command. Shutdown guest and boot again, I need to input block password to resume the guest. But I find inputting any string or even input nothing and only need to press "enter" key could resume the guest. 

Version-Release number of selected component (if applicable):
kernel-2.6.32-171.el6.x86_64
qemu-kvm-0.12.1.2-2.172.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create a disk:
# qemu-img create -f qcow2 disk-1.qcow2 2G -o encryption
Formatting 'disk-1.qcow2', fmt=qcow2 size=2147483648 encryption=on cluster_size=65536 

2.Boot a pre-installed guest and attach the encrypted disk.
/usr/libexec/qemu-kvm -m 2G -smp 2 -cpu cpu64-rhel6,+x2apic -usbdevice tablet -drive file=win7-64-virtio-new.qcow2,format=qcow2,if=none,id=drive-ide0-0-0,werror=stop,rerror=stop,cache=none,boot=on -device virtio-blk-pci,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,id=hostnet0,script=/etc/qemu-ifup -device e1000,netdev=hostnet0,mac=00:10:2a:20:06:58,bus=pci.0,addr=0x6 -boot c -uuid 055a379d-a3e8-46a3-8a4c-fe4418714e0f -rtc-td-hack -no-kvm-pit-reinjection -monitor stdio -qmp tcp:0:4445,server,nowait -name win7-64-balloon -spice port=5931,disable-ticketing -vga qxl -device virtio-balloon-pci,bus=pci.0,id=balloon0 -drive file=disk-1.qcow2,format=qcow2,if=none,id=virtio1,werror=stop,rerror=stop,cache=none -device virtio-blk-pci,drive=virtio1,id=virtio1

 
3.change a password for the disk.
(qemu) info status 
VM status: paused
(qemu) block_passwd virtio1 redhat
(qemu)

4. shutdown guest and then reboot again

5. Check the status and input the password to resume guest.
(qemu) info status 
VM status: paused
(qemu) 
(qemu) c
virtio1 (disk-1.qcow2) is encrypted.
Password: ************
handle_dev_input: start
(qemu)

  
Actual results:
In step5, input any number/letter/string or input nothing can resume the guest.

Expected results:
Password should work.

Additional info:

Comment 2 Kevin Wolf 2011-09-12 09:07:54 UTC
If you enter nothing or a different password you won't be able to read out what you wrote to the disk. You'll read garbage instead. For example, if you added a step "3b. Create a file system on the encrypted disk", you wouldn't be able to mount it after step 5.