Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-122791

qemu-ga generates "dac_override" and "dac_read_search" AVCs when freezing/thawing

Linking RHIVOS CVEs to...Migration: Automation ...RHELPRIO AssignedTeam ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • None
    • Low
    • rhel-se-security
    • 3
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      Creating as a clone of https://issues.redhat.com/browse/RHEL-52476
      Looks like the above was closed and an errata provided. But does not look like it was backported to RHEL 8. Need the above backported to RHEL 8 as well.

      What were you trying to do that didn't work?

      When freezing/thawing the file systems of a QEMU/KVM VM, the following AVCs are generated if a mount point is not owned by root:

      allow virt_qemu_ga_t self:capability { dac_override dac_read_search };
      
      type=PROCTITLE msg=audit(08/02/2024 09:14:51.317:90) : proctitle=/usr/bin/qemu-ga --method=virtio-serial --path=/dev/virtio-ports/org.qemu.guest_agent.0 --allow-rpcs=guest-sync-delimited,guest- 
      type=SYSCALL msg=audit(08/02/2024 09:14:51.317:90) : arch=x86_64 syscall=openat success=no exit=EACCES(Permission denied) a0=AT_FDCWD a1=0x55e03ce2bfc0 a2=O_RDONLY|O_CLOEXEC a3=0x0 items=0 ppid=1 pid=871 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=qemu-ga exe=/usr/bin/qemu-ga subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null) 
      type=AVC msg=audit(08/02/2024 09:14:51.317:90) : avc:  denied  { dac_override } for  pid=871 comm=qemu-ga capability=dac_override  scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:system_r:virt_qemu_ga_t:s0 tclass=capability permissive=0 
      type=AVC msg=audit(08/02/2024 09:14:51.317:90) : avc:  denied  { dac_read_search } for  pid=871 comm=qemu-ga capability=dac_read_search  scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:system_r:virt_qemu_ga_t:s0 tclass=capability permissive=0 
      

      This AVC can be fixed by enabling virt_qemu_ga_manage_ssh, but this has to be considered as a workaround, because the boolean is unrelated.

      The reason for getting this is the mount table is parsed then file systems opened.

      Please provide the package NVR for which bug is seen:

      selinux-policy-38.1.35-2.el9_4.noarch

      How reproducible:

      Always

      Steps to reproduce

      1. Create a disk image
        # truncate -s 1G /root/renaud.img
        mkfs.xfs /root/renaud.img
        mkdir /var/lib/renaud
        
      1. Mount the disk image and change permissions
        # mount /root/renaud.img /var/lib/renaud
        # chown renaud:users /var/lib/renaud
        # restorecon -Fr /var/lib/renaud
        
      1. Execute "thaw" from the hypervisor
        $ virsh qemu-agent-command --domain rhel9 '{ "execute" : "guest-fsfreeze-thaw" }'

      Expected results

      No AVC

      Actual results

      type=PROCTITLE msg=audit(08/02/2024 09:34:59.765:124) : proctitle=/usr/bin/qemu-ga --method=virtio-serial --path=/dev/virtio-ports/org.qemu.guest_agent.0 --allow-rpcs=guest-sync-delimited,guest- 
      type=SYSCALL msg=audit(08/02/2024 09:34:59.765:124) : arch=x86_64 syscall=openat success=no exit=EACCES(Permission denied) a0=AT_FDCWD a1=0x560a41583fb0 a2=O_RDONLY|O_CLOEXEC a3=0x0 items=0 ppid=1 pid=1974 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=qemu-ga exe=/usr/bin/qemu-ga subj=system_u:system_r:virt_qemu_ga_t:s0 key=(null) 
      type=AVC msg=audit(08/02/2024 09:34:59.765:124) : avc:  denied  { dac_override } for  pid=1974 comm=qemu-ga capability=dac_override  scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:system_r:virt_qemu_ga_t:s0 tclass=capability permissive=0 
      type=AVC msg=audit(08/02/2024 09:34:59.765:124) : avc:  denied  { dac_read_search } for  pid=1974 comm=qemu-ga capability=dac_read_search  scontext=system_u:system_r:virt_qemu_ga_t:s0 tcontext=system_u:system_r:virt_qemu_ga_t:s0 tclass=capability permissive=0 

              se-security se-security se-security
              rhn-support-rknipp Robert Knipp
              Zdenek Pytela Zdenek Pytela
              Milos Malik Milos Malik
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: