RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 790668 - [Svirt]The context of the save file is not correct
Summary: [Svirt]The context of the save file is not correct
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-15 06:48 UTC by yanbing du
Modified: 2012-04-02 10:07 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-04-02 10:07:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description yanbing du 2012-02-15 06:48:09 UTC
Description of problem:
Save a running guest, the context of the save file is different with the expect result. 
The actual result is: system_u:object_r:virt_tmp_t:s0
The expect result is: system_u:object_r:svirt_image_t:s0
BTW, after downgrade libvirt from libvirt-0.9.10-1 to libvirt-0.9.10-0rc2, the result is correct.
Not sure if this is a regression bug or new design result.

Version-Release number of selected component (if applicable):
libvirt-0.9.10-1.el6.x86_64
qemu-kvm-0.12.1.2-2.225.el6.x86_64
kernel-2.6.32-220.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Start a normal guest and save it.
  # virsh save test /tmp/test.save

Domain test saved to /tmp/test.save

2.Check the context of the save file.
  # ll -Z /tmp/test.save 
-rw-------. root root system_u:object_r:virt_tmp_t:s0  /tmp/test.save

3. Downgrade libvirt to libvirt-0.9.10-0rc2 and do step1 & step2 again.
 # virsh save test /tmp/test3.save

Domain test saved to /tmp/test3.save

 # ll -Z /tmp/test3.save 
-rw-------. root root system_u:object_r:svirt_image_t:s0:c506,c657 /tmp/test3.save

  
Actual results:
the context of the save file is system_u:object_r:virt_tmp_t:s0

Expected results:
the context of the save file should be system_u:object_r:svirt_image_t:s0

Additional info:
SELinux is Enforcing.
After upgrade libvirt back to libvirt-0.9.10-1, then save the guest, will get a different result:
# virsh save test /tmp/test5.save

Domain test saved to /tmp/test5.save

# ll -Z /tmp/test5.save 
-rw-------. root root unconfined_u:object_r:virt_tmp_t:s0 /tmp/test5.save
  
The security labels is added automatically, and default type is 'dynamic', following is the XML content after start the guest:
----new libvirt version----
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c422,c458</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c422,c458</imagelabel>
  </seclabel>
----
----old libvirt version----
<seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c570,c773</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c570,c773</imagelabel>
  </seclabel>
----

Comment 2 Eric Blake 2012-02-15 16:27:16 UTC
I think this is an unintentional change, probably a side-effect of:

commit c8683f231dd227da8540f3249d7e332ec7a75ad7
Author: Jiri Denemark <jdenemar>
Date:   Mon Feb 6 14:53:24 2012 +0100

    qemu: Always use iohelper for dumping domain core
    
    Qemu uses non-blocking I/O which doesn't play nice with regular file
    descriptors. We need to pass a pipe to qemu instead, which can easily be
    done using iohelper.

Comment 4 Jiri Denemark 2012-04-02 10:07:05 UTC
It was indeed unintentional but it was actually a bug fix :-) The "system_u:object_r:svirt_image_t:s0:c506,c657" context was actually an undesired side effect of relabeling file descriptor in a way that qemu can write to it. Since we now pass a pipe instead, the file's context is not affected. Also the old context didn't make sense at all with dynamic labeling once the domain shuts down.


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