Bug 496250 - libvirtd/qemu-kvm appears to want to write .iso file (throws "write" AVC on install of F11_Spin1)
libvirtd/qemu-kvm appears to want to write .iso file (throws "write" AVC on i...
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: qemu (Show other bugs)
11
All Linux
low Severity medium
: ---
: ---
Assigned To: Justin M. Forbes
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-17 10:34 EDT by Tom London
Modified: 2010-06-28 07:52 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-06-28 07:52:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tom London 2009-04-17 10:34:34 EDT
Description of problem:
Got this blocked write attempt when creating/installing F11_Spin1 guest from "Virtual Machine Manager" (i.e., I just followed the GUI), where I indicated install source to be ~/VirtualMachines/Fedora-11-Snap1-x86_64-Live.iso.

The installation continued, apparently successfully.

Running "qemu-kvm -m 1024 -cdrom ~/VirtualMachines/Fedora-11-Snap1-x86_64-Live.iso -boot d" does NOT throw write AVC.

Write access to .iso?  

Issue with libvirt?  qemu-kvm?


type=USER_AUTH msg=audit(1239978445.433:33111): user pid=13644 uid=500 auid=500 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:authentication acct="root" exe="/usr/libexec/polkit-grant-helper-pam" (hostname=?, addr=?, terminal=? res=success)'
type=USER_ACCT msg=audit(1239978445.436:33112): user pid=13644 uid=500 auid=500 ses=1 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:accounting acct="root" exe="/usr/libexec/polkit-grant-helper-pam" (hostname=?, addr=?, terminal=? res=success)'
type=ANOM_PROMISCUOUS msg=audit(1239978491.900:33113): dev=vnet0 prom=256 old_prom=0 auid=4294967295 uid=0 gid=0 ses=4294967295
type=SYSCALL msg=audit(1239978491.900:33113): arch=c000003e syscall=16 success=yes exit=0 a0=11 a1=89a2 a2=7f53bf5bfb50 a3=7f53bf5bf900 items=0 ppid=1 pid=2793 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="libvirtd" exe="/usr/sbin/libvirtd" subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1239978491.992:33114): avc:  denied  { write } for  pid=13719 comm="qemu-kvm" name="Fedora-11-Snap1-x86_64-Live.iso" dev=dm-0 ino=201340 scontext=system_u:system_r:svirt_t:s0:c334,c630 tcontext=system_u:object_r:virt_content_t:s0 tclass=file
type=SYSCALL msg=audit(1239978491.992:33114): arch=c000003e syscall=2 success=no exit=-13 a0=7fffa1f43b10 a1=1002 a2=1a4 a3=30 items=0 ppid=1 pid=13719 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="qemu-kvm" exe="/usr/bin/qemu-kvm" subj=system_u:system_r:svirt_t:s0:c334,c630 key=(null)
type=ANOM_PROMISCUOUS msg=audit(1239978572.229:33115): dev=vnet0 prom=0 old_prom=256 auid=4294967295 uid=0 gid=0 ses=4294967295




Version-Release number of selected component (if applicable):
qemu-system-x86-0.10-8.local.fc11.x86_64
libvirt-0.6.2-2.fc11.x86_64
selinux-policy-3.6.12-6.fc11.noarch

How reproducible:
Every time

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Daniel Berrange 2009-04-17 10:57:07 EDT
I think this is almost certainly QEMU's fault. There is no way for us to tell QEMU that the CDROM image should only be opened readonly - even though QEMU only emulates a CDROM and not CDRW, it'll still try and open it read-write. If this fails it then falls back to read-only.

So you'll always see the denial about the failure opening it read-write, and then QEMU will happily carry on with it read-only.

We really need to improve QEMU so that 

 a. it doesn't try to open CDROM images read-write, when its only emulating a read-only disk device type
 b. it allows libvirt to also tell it that a disk is read-only.
Comment 2 Daniel Walsh 2009-04-17 11:10:00 EDT
Ok I will dontaudit it for now.

Although this would cover up a potential attack route.

If qemu is actually calling the access(cdrom, W_OK), we are working on a fix for this, to not generate the access denied.
Comment 3 Daniel Berrange 2009-04-17 11:18:31 EDT
In QEMU's virtual block layer, block.c, it does

    ret = drv->bdrv_open(bs, filename, open_flags);
    if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
        ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR);
        bs->read_only = 1;
    }


These two drv->bdrv_open calls eventually end up with 

  open(filename, O_RDWR)

and 

  open(filename, O_RDONLY)

respectively.
Comment 4 Itamar Reis Peixoto 2009-04-17 11:29:47 EDT
somedays ago I have see a comment in mailing list about a fedora user booting livedvd or livecd and getting the RW disk erased.

he has booted with a read-only disk and no problems.

probably is not related to qemu
Comment 5 Mark McLoughlin 2009-04-19 08:47:46 EDT
(In reply to comment #1)
> 
> We really need to improve QEMU so that 
> 
>  a. it doesn't try to open CDROM images read-write, when its only emulating a
> read-only disk device type
>  b. it allows libvirt to also tell it that a disk is read-only.  

danpb: could you send a mail to qemu-devel about this?

(Not adding to F11VirtTarget since we've used dontaudit to avoid the warning)
Comment 6 Fedora Admin XMLRPC Client 2009-05-07 08:12:03 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 7 Fedora Admin XMLRPC Client 2009-05-07 08:13:20 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 8 Fedora Admin XMLRPC Client 2009-05-07 08:13:47 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 9 Fedora Admin XMLRPC Client 2009-05-07 13:58:09 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 10 Bug Zapper 2009-06-09 10:00:15 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 11 Fedora Admin XMLRPC Client 2010-03-09 11:53:23 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 12 Fedora Admin XMLRPC Client 2010-03-09 12:17:15 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 13 Bug Zapper 2010-04-27 09:43:54 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 14 Bug Zapper 2010-06-28 07:52:39 EDT
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.