Bug 859027
Summary: | repeated client_migrate_info caused freeing invalid pointer, followed ultimately by segfault in _int_malloc | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | David Jaša <djasa> | ||||
Component: | spice-server | Assignee: | Yonit Halperin <yhalperi> | ||||
Status: | CLOSED ERRATA | QA Contact: | Desktop QE <desktop-qa-list> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 6.4 | CC: | acathrow, areis, bsarathy, cfergeau, dblechte, desktop-qa-list, djasa, juzhang, kraxel, lnovich, mkenneth, pvine, qzhang, uril, virt-maint | ||||
Target Milestone: | beta | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | spice-server-0.12.4-1.el6 | Doc Type: | Bug Fix | ||||
Doc Text: |
Cause:
If client_migrate_info was called once with
cert-host-subject and then again without
cert-host-subject, on a third call to
client_migrate info, the cert-host-subject from the first
call would have been freed for the second time.
[ An even more detailed explanation:
In the first call with cert-host-subject a pointer was
allocated.
In the second call without cert-host-subject the pointer
was freed, but not set to NULL.
In the third call that same pointer was freed again.
]
Consequence:
glibc complains about double free and later it causes
a segmentation fault.
Fix:
Set the pointer to NULL, if cert-host-subject is not given.
[ That's fix happens in the "second" migrate-info ]
Result:
The pointer is freed only once and qemu-kvm/spice-server does not crash.
|
Story Points: | --- | ||||
Clone Of: | Environment: | ||||||
Last Closed: | 2013-11-21 07:38:43 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: |
|
When I tried to run source qemu in valgrind: valgrind -v --error-limit=no --tool=memcheck --track-origins=yes --leak-check=full qemu-kvm -monitor stdio -spice addr=::,tls-port=5811,x509-dir=/etc/pki/libvirt-spice,seamless-migration=on,disable-ticketing it got crazy as soon as I connected to it, repeating this stuff over an over (even when I rerun it with plaintext-port only and no x509-dir): ==23650== Use of uninitialised value of size 8 ==23650== at 0x9970C20: bn_mul_mont (x86_64-mont.s:152) ==23650== by 0x152F1A6801292306: ??? ==23650== by 0x8CD975FE1C327A67: ??? ==23650== by 0xD0E8B5EB10CDE393: ??? ==23650== by 0xEF2A0D7A89142F69: ??? ==23650== by 0x1800C336037BE0BF: ??? ==23650== by 0xF933698707AE7DBD: ??? ==23650== by 0x8F86049E00EC185C: ??? ==23650== by 0x644D9C308B6DECCD: ??? ==23650== Uninitialised value was created by a heap allocation ==23650== at 0x4A05FDE: malloc (vg_replace_malloc.c:236) ==23650== by 0x993995D: CRYPTO_malloc (mem.c:306) ==23650== by 0x996BDDD: bnrand (bn_rand.c:134) ==23650== by 0x996BC47: bn_rand_range (bn_rand.c:281) ==23650== by 0x996EC3A: BN_is_prime_fasttest_ex (bn_prime.c:322) ==23650== by 0x996F203: BN_generate_prime_ex (bn_prime.c:199) ==23650== by 0x997854A: RSA_generate_key_ex (rsa_gen.c:213) ==23650== by 0x657C587: reds_handle_read_link_done (reds.c:1539) ==23650== by 0x6577D75: spice_server_add_client (reds.c:3035) ==23650== by 0x6577DD9: reds_accept (reds.c:3012) ==23650== by 0x16B06E: main_loop_wait (vl.c:3999) ==23650== by 0x18C9A9: kvm_main_loop (qemu-kvm.c:2244) When run under gdb, I couldn't make qemu do even the free() of invalid pointer. qemu just passes on the info to spice server, reassigning. This request was not resolved in time for the current release. Red Hat invites you to ask your support representative to propose this request, if still desired, for consideration in the next release of Red Hat Enterprise Linux. Hi, Is it possible that you called client_migrate_info once with <host-subject> and then at a following call you (maybe accidently) omitted the <host-subject> and then the following call crashed? I posted a patch for the above bug http://patchwork.freedesktop.org/patch/13728/ Please let me know if you manage to reproduce the bug without omitting the host-subject. (In reply to Yonit Halperin from comment #6) > Hi, > > Is it possible that you called client_migrate_info once with <host-subject> > and then at a following call you (maybe accidently) omitted the > <host-subject> and then the following call crashed? > > I posted a patch for the above bug > http://patchwork.freedesktop.org/patch/13728/ > > Please let me know if you manage to reproduce the bug without omitting the > host-subject. Yes, IIRC it was this case. To clarify - I meant that I did repeated client_migrate_info, some with host subject specified and following without. 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. http://rhn.redhat.com/errata/RHBA-2013-1571.html |
Created attachment 614861 [details] qemu backtrace Description of problem: repeated client_migrate_info caused freeing invalid pointer, followed ultimately by segfault in _int_malloc. The freeing of invalid pointer seems to be quite common (I see it second time in fairly short time frame) but the segmentation fault happened to me for the first time. Version-Release number of selected component (if applicable): qemu-kvm-0.12.1.2-2.312.el6.x86_64 spice-server-0.11.3-1_test2.el6.x86_64 How reproducible: didn't try to reproduce Steps to Reproduce: 0. have a set of x509 certs/keys in /etc/pki/libvirt-spice 1. run source qemu: qemu-kvm -monitor stdio -spice addr=::,tls-port=5811,x509-dir=/etc/pki/libvirt-spice,seamless-migration=on,disable-ticketing 2. run dest qemu: qemu-kvm -monitor stdio -spice addr=::,tls-port=5813,x509-dir=/etc/pki/libvirt-spice,seamless-migration=on,disable-ticketing -incoming tcp::5712 3. connect with client: remote-viewer --spice-ca-file /etc/pki/libvirt-spice/ca-cert.pem spice://<hostame>/?tls-port=5811 NOTE: <hostname> must match CN in Subject of ${x509-dir}/server-cert.pem 4. issue repeatedly this command on qemu CLI: client_migrate_info spice 127.0.0.1 0 5813 <Subject_of_server-cert.pem> note: you may try without host subject specified as well Actual results: after several cycles, freeing invalid pointers appear: *** glibc detected *** qemu-kvm: free(): invalid pointer: 0x00007f6a0e43a710 *** after several more cycles, full segmentation fault occurs Expected results: qemu will never segfault Additional info: