Bug 717606

Summary: screendump fails silently instead of printing an error message
Product: Red Hat Enterprise Linux 7 Reporter: Michal Privoznik <mprivozn>
Component: qemu-kvmAssignee: Luiz Capitulino <lcapitulino>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: areis, juzhang, knoel, lcapitulino, mazhang, mkenneth, shuang, shu, tburke, virt-maint
Target Milestone: rcKeywords: Reopened
Target Release: 7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu 1.3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 12:00:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Privoznik 2011-06-29 11:06:50 UTC
Description of problem:
When trying to do screendump into a previously created file which qemu does not have enough permissions to write to, qemu silently fails writing any data. I'd expect qemu to print error message saying something about write fail. However, other command may be affected as well.

Version-Release number of selected component (if applicable):
0.14.50 but other versions may be affected as well

How reproducible:
100%

Steps to Reproduce:
as root:
1. touch /tmp/screenshot.ppm
2. chmod 0600 /tmp/screenshot.ppm

as normal user:
1. start qemu
2. screendump /tmp/screenshot.ppm
  
Actual results:
qemu fails silently

Expected results:
qemu prints error message about insufficient rights, or unsuccessful write

Additional info:

Comment 2 Michal Privoznik 2011-06-29 12:48:10 UTC
Even better solution might be to even fail on that monitor command.

Comment 5 Luiz Capitulino 2012-08-15 21:10:37 UTC
Michal,

Did you hit this problem in HMP or QMP?

Upstream, this is fixed in both by my series that converts the screendump command to the qapi. This means that this will be fixed in RHEL7.0 too (although my series haven't been merged yet).

For RHEL6.x, we don't support HMP. I could fix this for QMP if it's an issue for libvirt, but it would require a RHEL-only patch which would return limited information...

Is this really needed in 6.4 or can we move it to RHEL7.0?

Comment 6 Michal Privoznik 2012-08-20 10:53:47 UTC
Luiz,

I've reproduced the problem in both HMP and QMP on upstream qemu. I haven't tested RHEL qemu though. Maybe it's because your patches haven't been merged yet.

Even this being tricky bug (qemu and libvirt subsequently report success even for error case) I am okay with moving this to rhel7.

Comment 7 Luiz Capitulino 2012-08-20 13:24:01 UTC
(In reply to comment #6)
> Luiz,
> 
> I've reproduced the problem in both HMP and QMP on upstream qemu. I haven't
> tested RHEL qemu though. Maybe it's because your patches haven't been merged
> yet.

Yes, they haven't. I'll respin my series soon and will CC you when I post it.

> Even this being tricky bug (qemu and libvirt subsequently report success
> even for error case) I am okay with moving this to rhel7.

Closing as DEFERRED then.

Comment 8 Luiz Capitulino 2012-09-11 12:56:43 UTC
The series converting the screendump command to the qapi has been merged upstream (git log 149474c9..0ab6b636) and, as it adds full error handling, it fixes this bug:

(qemu) screendump /tmp/screenshot.ppm
failed to open file '/tmp/screenshot.ppm': Permission denied
(qemu)

Comment 9 Luiz Capitulino 2012-09-18 17:18:19 UTC
Re-opening so that we can track this as a RHEL7 bz.

Comment 10 Luiz Capitulino 2012-09-18 17:21:23 UTC
Complementing last comment: we may need to backport patches merged for qemu 1.3 case we don't rebase (in that case RHEL7's base would be qemu 1.2). So, it's better to reopen this so that we can track it properly.

Comment 13 mazhang 2014-01-21 05:55:13 UTC
Reproduced this bug. 
Host:
qemu-kvm-1.2.0-21.el7.x86_64
kernel-3.7.0-0.36.el7.x86_64

Steps:
as root:
1. touch /tmp/screenshot.ppm
2. chmod 0600 /tmp/screenshot.ppm

as normal user:
1. start qemu
2. screendump /tmp/screenshot.ppm

Result:
Qemu fails silently.


Verified this bug with qemu-kvm-1.5.3-38.el7.x86_64.
Host:
kernel-3.10.0-69.el7.x86_64
qemu-kvm-1.5.3-38.el7.x86_64

Result:
Qemu prints error message.
(qemu) screendump  /tmp/screenshot.ppm 
failed to open file '/tmp/screenshot.ppm': Permission denied

This bug has been fixed.

Comment 15 Ludek Smid 2014-06-13 12:00:06 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.