Bug 1676354

Summary: Segmentation fault when list filesystems of guest in read-only mode
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Lili Zhu <lizhu>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Lili Zhu <lizhu>
Severity: high Docs Contact:
Priority: urgent    
Version: 8.1CC: dyuan, fjin, jdenemar, jsuchane, jtomko, mtessun, rbalakri, xuzhang, yafu
Target Milestone: rcKeywords: Automation, Regression
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-5.0.0-3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-29 16:05:30 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:

Description Lili Zhu 2019-02-12 03:24:55 UTC
Description of problem:
Segmentation fault when list filesystems of guest in read-only mode

Version-Release number of selected component (if applicable):
libvirt-5.0.0-2.el8.x86_64

How reproducible:
1005

Steps to Reproduce:
1.prepare a guest
# virsh list --all
 Id   Name             State
--------------------------------
 4    avocado-vt-vm1   running

2. list its filesystems in read-only mode
# virsh -r domfsinfo avocado-vt-vm1 
error: Unable to get filesystem information
Segmentation fault (core dumped)


Expected results:
no segmentation fault

Additional info:

(gdb) r -r domfsinfo avocado-vt-vm1 
Starting program: /usr/bin/virsh -r domfsinfo avocado-vt-vm1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffe0973700 (LWP 25073)]
error: Unable to get filesystem information

Thread 1 "virsh" received signal SIGSEGV, Segmentation fault.
0x00007ffff3b76491 in free () from /lib64/libc.so.6

(gdb) bt full
#0  0x00007ffff3b76491 in free () from /lib64/libc.so.6
No symbol table info available.
#1  0x00007ffff7430baf in virFree (ptrptr=0x555555822900) at util/viralloc.c:581
        save_errno = 0
#2  0x00007ffff765f668 in virDomainFSInfoFree (info=<optimized out>) at libvirt-domain.c:11895
        i = <optimized out>
#3  0x0000555555593cd2 in cmdDomFSInfo (ctl=0x7fffffffdfc0, cmd=<optimized out>) at virsh-domain.c:13990
        dom = 0x55555582b590
        ret = -1
        i = 0
        j = <optimized out>
        info = 0x5555557fe4c0 <last_error>
        table = 0x0
#4  0x00005555555bf282 in vshCommandRun (ctl=0x7fffffffdfc0, cmd=0x555555822200) at vsh.c:1310
      ....
#5  0x0000555555581876 in main (argc=4, argv=<optimized out>) at virsh.c:920
      ....
(gdb) f 3
#3  0x0000555555593cd2 in cmdDomFSInfo (ctl=0x7fffffffdfc0, cmd=<optimized out>) at virsh-domain.c:13990
13990	virsh-domain.c: No such file or directory.
(gdb) p *info[i]
$1 = {mountpoint = 0x140000001d <error: Cannot access memory at address 0x140000001d>, 
  name = 0x555555822440 "operation forbidden: read only access prevents virDomainGetFSInfo", fstype = 0x2 <error: Cannot access memory at address 0x2>, ndevAlias = 0, 
  devAlias = 0x0}

Comment 1 Ján Tomko 2019-02-12 12:20:40 UTC
Upstream patches:
https://www.redhat.com/archives/libvir-list/2019-February/msg00664.html

Comment 4 Lili Zhu 2019-03-04 02:11:47 UTC
Verify this bug with:
libvirt-5.0.0-5.module+el8+2850+33063f9c.x86_64

Verification steps:
1.prepare a guest
# virsh list --all
 Id   Name             State
--------------------------------
 4    avocado-vt-vm1   running

2. list its filesystems in read-only mode
# virsh -r domfsinfo avocado-vt-vm1 
error: Unable to get filesystem information
error: operation forbidden: read only access prevents virDomainGetFSInfo

No segmentation fault, mark the bug as verified.

Comment 6 errata-xmlrpc 2019-05-29 16:05:30 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.

https://access.redhat.com/errata/RHBA-2019:1293