Bug 1430988 - Permission denied when reloading virtlogd
Summary: Permission denied when reloading virtlogd
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: Fangge Jin
: 1483466 1541268 (view as bug list)
Depends On:
Blocks: 1389374
TreeView+ depends on / blocked
Reported: 2017-03-10 03:53 UTC by Fangge Jin
Modified: 2021-06-10 12:02 UTC (History)
7 users (show)

Fixed In Version: libvirt-3.7.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-04-10 10:42:33 UTC
Target Upstream Version:

Attachments (Terms of Use)
virtlogd log (91.92 KB, text/plain)
2017-03-10 03:53 UTC, Fangge Jin
no flags Details
backtrace (2.88 KB, text/plain)
2017-03-10 03:59 UTC, Fangge Jin
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 10:43:05 UTC

Description Fangge Jin 2017-03-10 03:53:21 UTC
Created attachment 1261769 [details]
virtlogd log

Description of problem:
1) The guest includes a file-backend serial device as below:
    <serial type='file'>
      <source path='/var/log/libvirt/qemu/log' append='off'/>
      <log file='/var/log/libvirt/qemu/guestname-serial0.log' append='off'/>
      <target port='0'/>
      <alias name='serial0'/>

2) Start guest, then reload virtlogd, virtlogd will fail to open the backend file and exited with two possible status:

a. At some times, virtlogd crashed:
# systemctl status virtlogd
● virtlogd.service - Virtual machine log manager
   Loaded: loaded (/usr/lib/systemd/system/virtlogd.service; indirect; vendor preset: disabled)
   Active: failed (Result: core-dump) since Thu 2017-03-09 05:16:38 EST; 11s ago
     Docs: man:virtlogd(8)
  Process: 24245 ExecReload=/bin/kill -USR1 $MAINPID (code=exited, status=0/SUCCESS)
  Process: 23771 ExecStart=/usr/sbin/virtlogd $VIRTLOGD_ARGS (code=dumped, signal=SEGV)
 Main PID: 23771 (code=dumped, signal=SEGV)

b. At some times, virtlogd exited with status=3:
# systemctl status virtlogd
● virtlogd.service - Virtual machine log manager
   Loaded: loaded (/usr/lib/systemd/system/virtlogd.service; indirect; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2017-03-09 22:21:25 EST; 2s ago
     Docs: man:virtlogd(8)
  Process: 28655 ExecReload=/bin/kill -USR1 $MAINPID (code=exited, status=0/SUCCESS)
  Process: 28553 ExecStart=/usr/sbin/virtlogd $VIRTLOGD_ARGS (code=exited, status=3)
 Main PID: 28553 (code=exited, status=3)

3) Check the virtlogd.log:
error : virRotatingFileWriterEntryNew:113 : Unable to open file: /var/log/libvirt/qemu/log: Permission denied

Version-Release number of selected component:

How reproducible:

Steps to Reproduce:
1.Start guest

2.Reload virtlogd
# systemctl reload virtlogd

3. Check the virtlogd status

Actual results:
virtlogd met "permission denied" and failed to reload

Expected results:
virtlogd reload successfully

Comment 2 Fangge Jin 2017-03-10 03:59:25 UTC
Created attachment 1261770 [details]

Comment 3 Fangge Jin 2017-03-10 04:54:32 UTC
The audit log:
time->Thu Mar  9 22:27:45 2017
type=SYSCALL msg=audit(1489116465.428:100691): arch=c000003e syscall=2 success=no exit=-13 a0=7fa9883f6420 a1=80441 a2=180 a3=7fa9883f5b80 items=0 ppid=1 pid=28818 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="virtlogd" exe="/usr/sbin/virtlogd" subj=system_u:system_r:virtlogd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1489116465.428:100691): avc:  denied  { dac_override } for  pid=28818 comm="virtlogd" capability=1  scontext=system_u:system_r:virtlogd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:virtlogd_t:s0-s0:c0.c1023 tclass=capability

Comment 4 Fangge Jin 2017-03-10 05:51:13 UTC
I seems that the failed status depends on the log_level of virtlogd:
a. when log_level is set to 1 in virtlogd.conf, virtlogd crashed
b. when log_level is set to the default value in virtlogd.conf, virtlogd exited with status=3

Comment 5 Pavel Hrdina 2017-06-16 15:00:48 UTC
Upstream commit:

commit e13e8808f9270f4b3b6f4abb8ec473eef81cc1b9
Author: Pavel Hrdina <phrdina@redhat.com>
Date:   Mon May 29 14:27:51 2017 +0200

    security: don't relabel chardev source if virtlogd is used as stdio handler


Comment 7 Fangge Jin 2017-10-24 04:15:40 UTC
Verify pass with libvirt-3.8.0-1.virtcov.el7.x86_64

Comment 8 Ján Tomko 2017-11-24 14:09:56 UTC
*** Bug 1483466 has been marked as a duplicate of this bug. ***

Comment 9 Artom Lifshitz 2018-02-23 01:27:28 UTC
*** Bug 1541268 has been marked as a duplicate of this bug. ***

Comment 13 errata-xmlrpc 2018-04-10 10:42:33 UTC
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.


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