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 1447943 - qemu guest agent can not read/write existing file in guest
Summary: qemu guest agent can not read/write existing file in guest
Keywords:
Status: CLOSED NOTABUG
Alias: None
Deadline: 2017-07-26
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-guest-agent
Version: 7.4
Hardware: ppc64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ademar Reis
QA Contact: FuXiangChun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-04 09:45 UTC by FuXiangChun
Modified: 2017-07-26 07:04 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-04 13:27:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description FuXiangChun 2017-05-04 09:45:20 UTC
Description of problem:

{"execute":"guest-file-open","arguments":{"path":"/tmp/fuxc","mode":"r"}}
{"error": {"class": "GenericError", "desc": "failed to open file '/tmp/fuxc' (mode: 'r'): Permission denied"}}

{"execute":"guest-file-open", "arguments":{"path":"/tmp/fuxc","mode":"w+"}}
{"error": {"class": "GenericError", "desc": "failed to open file '/tmp/fuxc' (mode: 'w+'): Permission denied"}}


Version-Release number of selected component (if applicable):
qemu-guest-agent-2.8.0-1.el7.x86_64
qemu-kvm-rhev-2.9.0-2.el7.x86_64
3.10.0-661.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Boot rhel7.4 guest

/usr/libexec/qemu-kvm -M pc -cpu Opteron_G5 -enable-kvm -m 8192 -smp 4,sockets=4,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid b18fdd6c-a213-4022-9ca4-5d07225e40b0 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,disable-legacy=on,disable-modern=false,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3,ioeventfd=on \

-chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -chardev socket,id=charchannel1,path=/home/channel1,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=3,chardev=charchannel1,id=channel1,name=org.qemu.guest_agent.0 \

-drive file=/home/rhel74-64-virtio.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,id=scsi0,bus=pci.0,ioeventfd=off -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,channel=0,scsi-id=0,lun=0,ver=mike,serial=ababab,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2e:5f:0a:1d:b1,bus=pci.0,addr=0x5,bootindex=2 -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :2 -spice disable-ticketing,port=5931 -vga qxl -monitor stdio

2.# nc -U /home/channel1γ€€in host

3.# touch /tmp/fuxc   in guest

4.# chmod 666 /tmp/fuxc in guest

5.{"execute":"guest-file-open","arguments":{"path":"/tmp/fuxc","mode":"r"}}
  {"execute":"guest-file-open", "arguments":{"path":"/tmp/fuxc","mode":"w+"}} 
  
Actual results:
{"error": {"class": "GenericError", "desc": "failed to open file '/tmp/fuxc' (mode: 'r'): Permission denied"}}

{"error": {"class": "GenericError", "desc": "failed to open file '/tmp/fuxc' (mode: 'w+'): Permission denied"}}

Expected results:
works

Additional info:
If write a no-exist file in guest. this command works.

Comment 2 Marc-Andre Lureau 2017-05-04 13:27:17 UTC
first of all, guest-file* commands are disabled by default in rhel

secondly, qemu-ga runs with restrictive selinux policies, you can see it denied to open files by default with: ausearch -c 'qemu-ga' --raw

closing as notabug

Comment 3 junma@redhat.com 2017-07-26 07:04:35 UTC
{"execute":"guest-file-open", "arguments":{"path":"/var/log/test-6","mode":"w+"}}'
{"error": {"class": "GenericError", "desc": "The command guest-file-open has been disabled for this instance"}}


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