Bug 1162707
| Summary: | qemu-guest-agent in guest is denied by selinux-policy when do s3/s4 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Luyao Huang <lhuang> | ||||
| Component: | selinux-policy | Assignee: | Miroslav Grepl <mgrepl> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 7.1 | CC: | dyuan, lhuang, lvrabec, mgrepl, mmalik, mprivozn, mzhan, plautrba, pvrabec, zhwang | ||||
| Target Milestone: | rc | ||||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | selinux-policy-3.13.1-17.el7 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2015-03-05 10:46:56 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Based on "success=no" I guess that AVCs were caught in enforcing mode. Could you re-test your scenario in permissive mode and collect AVCs too? # ausearch -m avc -m user_avc -m selinux_err -i -ts today Thanks you. # getenforce
Permissive
# ausearch -m avc -m user_avc -m selinux_err -i -ts today
type=SYSCALL msg=audit(11/11/2014 22:19:01.854:521) : arch=x86_64 syscall=access success=yes exit=0 a0=0x17ee630 a1=X_OK a2=0x7fffc2bac690 a3=0x7fffc2bac520 items=0 ppid=3846 pid=3874 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=00logging exe=/usr/bin/bash subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null)
type=AVC msg=audit(11/11/2014 22:19:01.854:521) : avc: denied { execute } for pid=3874 comm=00logging name=kmod dev="dm-0" ino=9092337 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:object_r:insmod_exec_t:s0 tclass=file
----
type=SYSCALL msg=audit(11/11/2014 22:19:01.854:522) : arch=x86_64 syscall=access success=yes exit=0 a0=0x17ee630 a1=R_OK a2=0x7fffc2bac690 a3=0x7fffc2bac520 items=0 ppid=3846 pid=3874 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=00logging exe=/usr/bin/bash subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null)
type=AVC msg=audit(11/11/2014 22:19:01.854:522) : avc: denied { read } for pid=3874 comm=00logging name=kmod dev="dm-0" ino=9092337 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:object_r:insmod_exec_t:s0 tclass=file
----
type=SYSCALL msg=audit(11/11/2014 22:19:01.855:523) : arch=x86_64 syscall=execve success=yes exit=0 a0=0x17ee630 a1=0x17ec450 a2=0x17ee690 a3=0x7fffc2bac640 items=0 ppid=3874 pid=3876 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=lsmod exe=/usr/bin/kmod subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null)
type=AVC msg=audit(11/11/2014 22:19:01.855:523) : avc: denied { execute_no_trans } for pid=3876 comm=00logging path=/usr/bin/kmod dev="dm-0" ino=9092337 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:object_r:insmod_exec_t:s0 tclass=file
type=AVC msg=audit(11/11/2014 22:19:01.855:523) : avc: denied { open } for pid=3876 comm=00logging path=/usr/bin/kmod dev="dm-0" ino=9092337 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:object_r:insmod_exec_t:s0 tclass=file
----
type=SYSCALL msg=audit(11/11/2014 22:19:02.012:537) : arch=x86_64 syscall=open success=yes exit=4 a0=0x1aa8140 a1=O_WRONLY|O_CREAT|O_TRUNC a2=0666 a3=0x7fffe1b97f60 items=0 ppid=3975 pid=3976 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=sysctl exe=/usr/sbin/sysctl subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null)
type=AVC msg=audit(11/11/2014 22:19:02.012:537) : avc: denied { write } for pid=3976 comm=sysctl name=acpi_video_flags dev="proc" ino=42006 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:object_r:sysctl_kernel_t:s0 tclass=file
----
type=USER_AVC msg=audit(11/11/2014 22:19:19.228:552) : pid=728 uid=dbus auid=unset ses=unset subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied { send_msg } for msgtype=method_call interface=org.freedesktop.PackageKit member=StateHasChanged dest=org.freedesktop.PackageKit spid=4065 tpid=3571 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:system_r:rpm_t:s0-s0:c0.c1023 tclass=dbus exe=/usr/bin/dbus-daemon sauid=dbus hostname=? addr=? terminal=?'
----
type=SYSCALL msg=audit(11/11/2014 22:19:19.293:553) : arch=x86_64 syscall=stat success=yes exit=0 a0=0x223e3e0 a1=0x7fff1db4dec0 a2=0x7fff1db4dec0 a3=0x8 items=0 ppid=4079 pid=4080 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=pm-powersave exe=/usr/bin/bash subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null)
type=AVC msg=audit(11/11/2014 22:19:19.293:553) : avc: denied { getattr } for pid=4080 comm=pm-powersave path=/dev/snapshot dev="devtmpfs" ino=6516 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:object_r:apm_bios_t:s0 tclass=chr_file
(some of them)
Do you have all AVCs from permissive mode? Created attachment 964478 [details]
audit.log
I have give the audit log in permissive mode. commit 5bea5d85e0e8efd89fbc64b3d235c7f5e834e18a
Author: Miroslav Grepl <mgrepl>
Date: Fri Dec 12 16:09:56 2014 +0100
Allow virt_qemu_ga_t to execute kmod.
commit 08f6adcb6558180867d40422b5c7a9739f1a59de
Author: Miroslav Grepl <mgrepl>
Date: Tue Jan 20 19:40:03 2015 +0100
Allow pm-suspend running as virt_qemu_ga to read /var/log/pm-suspend.log.
commit b08e0e36ba694dc7e3fd7d027542f9fdddca444e
Author: Miroslav Grepl <mgrepl>
Date: Tue Jan 20 19:39:20 2015 +0100
Add devicekit_read_log_files().
commit 8c6ea34309db51e45bfe9da3854fb05c1e9e82d5
Author: Miroslav Grepl <mgrepl>
Date: Tue Jan 20 19:35:37 2015 +0100
Allow virt_qemu_ga to dbus chat with rpm.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-0458.html |
Description of problem: qemu-guest-agent in guest is denied by selinux-policy when do s3/s4 Version-Release number of selected component (if applicable): IN guest: selinux-policy-targeted-3.13.1-9.el7.noarch selinux-policy-3.13.1-9.el7.noarch qemu-guest-agent-2.1.0-4.el7.x86_64 systemd-208-19.el7.x86_64 How reproducible: Steps to Reproduce: 1.prepare a happy guest have agent <channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/r7.agent'/> <target type='virtio' name='org.qemu.guest_agent.0'/> <alias name='channel0'/> <address type='virtio-serial' controller='0' bus='0' port='9'/> </channel> 2.start it and after guest os start do s3/s4 via libvirt command: # virsh dompmsuspend r7 mem error: Domain r7 could not be suspended error: internal error: unable to execute QEMU agent command 'guest-suspend-ram': child process has failed to suspend 3.get avc error IN guest, something like: type=AVC msg=audit(1415714424.618:414): avc: denied { read } for pid=3050 comm="pm-is-supported" name="passwd" dev="dm-0" ino=10756798 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:object_r:passwd_file_t:s0 tclass=file type=SYSCALL msg=audit(1415714424.618:414): arch=c000003e syscall=2 success=no exit=-13 a0=7f20b8508d8a a1=80000 a2=1b6 a3=0 items=0 ppid=684 pid=3050 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="pm-is-supported" exe="/usr/bin/bash" subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null) type=AVC msg=audit(1415714424.623:415): avc: denied { getattr } for pid=3050 comm="pm-is-supported" path="/dev/snapshot" dev="devtmpfs" ino=6516 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:object_r:apm_bios_t:s0 tclass=chr_file type=SYSCALL msg=audit(1415714424.623:415): arch=c000003e syscall=4 success=no exit=-13 a0=1a7a100 a1=7fffdf7de070 a2=7fffdf7de070 a3=8 items=0 ppid=684 pid=3050 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="pm-is-supported" exe="/usr/bin/bash" subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null) unconfined_u:object_r:devicekit_var_log_t:s0 tclass=file type=SYSCALL msg=audit(1415714424.667:420): arch=c000003e syscall=280 success=no exit=-13 a0=ffffffffffffff9c a1=7fff729ecb55 a2=0 a3=0 items=0 ppid=3062 pid=3084 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="touch" exe="/usr/bin/touch" subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null) type=AVC msg=audit(1415714424.668:421): avc: denied { open } for pid=3062 comm="pm-suspend" path="/var/log/pm-suspend.log" dev="dm-0" ino=19406745 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=unconfined_u:object_r:devicekit_var_log_t:s0 tclass=file type=SYSCALL msg=audit(1415714424.668:421): arch=c000003e syscall=2 success=no exit=-13 a0=1058370 a1=441 a2=1b6 a3=0 items=0 ppid=684 pid=3062 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="pm-suspend" exe="/usr/bin/bash" subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null) type=AVC msg=audit(1415714424.668:422): avc: denied { open } for pid=3062 comm="pm-suspend" path="/var/log/pm-suspend.log" dev="dm-0" ino=19406745 scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=unconfined_u:object_r:devicekit_var_log_t:s0 tclass=file type=SYSCALL msg=audit(1415714424.668:422): arch=c000003e syscall=2 success=no exit=-13 a0=1058370 a1=401 a2=1b6 a3=0 items=0 ppid=684 pid=3062 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="pm-suspend" exe="/usr/bin/bash" subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null) Actual results: cannot do s3/s4 via qemu-guest-agent Expected results: no avc and do s3/s4 success Additional info: IN guest : check qemu-guest-agent serice labels: # ps -efZ|grep qemu-ga system_u:system_r:virt_qemu_ga_t:s0 root 684 1 0 21:53 ? 00:00:00 /usr/bin/qemu-ga --method=virtio-serial --path=/dev/virtio-ports/org.qemu.guest_agent.0 --blacklist=guest-file-open guest-file-close guest-file-read guest-file-write guest-file-seek guest-file-flush -F/etc/qemu-ga/fsfreeze-hook And do not find this issue with old selinux