Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2073887

Summary: Segmentation fault when listening specified event types
Product: Red Hat Enterprise Linux 9 Reporter: Lili Zhu <lizhu>
Component: libvirtAssignee: Ján Tomko <jtomko>
libvirt sub component: CLI & API QA Contact: zhentang <zhetang>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: jdenemar, jtomko, lcheng, lmen, virt-maint, xuzhang, yanqzhan, zhetang
Version: 9.1Keywords: Automation, Regression
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-8.3.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:04:06 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: 8.3.0
Embargoed:

Description Lili Zhu 2022-04-11 04:18:35 UTC
Description of problem:
Segmentation fault when listening specified event types

Version-Release number of selected component (if applicable):
libvirt-8.2.0-1.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1.listening reboot event
# virsh event  --event reboot
Segmentation fault (core dumped)


Expected results:
no Seg fault

Additional info:
(gdb) t a a bt

Thread 2 (Thread 0x7fffe8c20640 (LWP 99613) "vshEventLoop"):
#0  0x00007ffff7742edf in poll () from /lib64/libc.so.6
#1  0x00007ffff792359c in g_main_context_iterate.constprop () from /lib64/libglib-2.0.so.0
#2  0x00007ffff78cc5d3 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#3  0x00007ffff7c12d94 in virEventGLibRunOnce () at ../src/util/vireventglib.c:512
#4  0x00005555555de855 in vshEventLoop (opaque=0x7fffffffddf0) at ../tools/vsh.c:2032
#5  0x00007ffff7c6fbb9 in virThreadHelper (data=<optimized out>) at ../src/util/virthread.c:256
#6  0x00007ffff769f6ca in start_thread () from /lib64/libc.so.6
#7  0x00007ffff763f3f0 in clone3 () from /lib64/libc.so.6

Thread 1 (Thread 0x7ffff6154500 (LWP 99609) "virsh"):
#0  0x00005555555b5a2d in cmdEvent (ctl=0x7fffffffddf0, cmd=0x55555566fa60) at ../tools/virsh-domain-event.c:955
#1  0x00005555555de74f in vshCommandRun (ctl=0x7fffffffddf0, cmd=0x55555566fa60) at ../tools/vsh.c:1308
#2  0x00005555555920a3 in main (argc=<optimized out>, argv=<optimized out>) at ../tools/virsh.c:906

Comment 1 Ján Tomko 2022-04-11 07:37:44 UTC
Proposed upstream patch:
https://listman.redhat.com/archives/libvir-list/2022-April/229987.html

Comment 2 Ján Tomko 2022-04-11 15:07:30 UTC
Pushed as:
commit df757e88fdb26e64e6b5a5c786e6f59d1d9b130a
Author:     Ján Tomko <jtomko>
CommitDate: 2022-04-11 17:03:49 +0200

    virsh: fix event registration for single event
    
    Allocate a larger 'data' array than strictly needed
    for simplicity and use 'ndata' as the index when
    filling it to put the single event at the first unused
    place, instead of at its index in the virshDomainEventCallbacks
    array.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=2073887
    
    Fixes: c6bb2746933bbe65877a5f8a8d60e100b0bf8a59
    Signed-off-by: Ján Tomko <jtomko>
    Reviewed-by: Michal Privoznik <mprivozn>

git describe: v8.2.0-130-gdf757e88fd

Comment 5 zhentang 2022-05-23 04:09:46 UTC
Verified 
Version libvirt-8.3.0-1.el9


# virsh event  --event reboot
event 'reboot' for domain 'rhel9'
events received: 1

Comment 7 errata-xmlrpc 2022-11-15 10:04:06 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 (Low: libvirt security, bug fix, and enhancement update), 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/RHSA-2022:8003