mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-06 06:27:41 -07:00
In the migration test we create several TLS certificates with
the TLS_* macros from crypto-tls-x509-helpers.h. These macros
create both a QCryptoTLSCertReq object which must be deinitialized
and also an on-disk certificate file. The migration test currently
removes the on-disk file in test_migrate_tls_x509_finish() but
never deinitializes the QCryptoTLSCertReq, which means that memory
allocated as part of it is leaked:
Indirect leak of 2 byte(s) in 1 object(s) allocated from:
#0 0x5558ba33712e in malloc (/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/asan/tests/qtest/migration-test+0x22f12e) (BuildId: 4c8618f663e538538cad19d35233124cea161491)
#1 0x7f64afc131f4 (/lib/x86_64-linux-gnu/libtasn1.so.6+0x81f4) (BuildId: 2fde6ecb43c586fe4077118f771077aa1298e7ea)
#2 0x7f64afc18d58 in asn1_write_value (/lib/x86_64-linux-gnu/libtasn1.so.6+0xdd58) (BuildId: 2fde6ecb43c586fe4077118f771077aa1298e7ea)
#3 0x7f64af8fc678 in gnutls_x509_crt_set_version (/lib/x86_64-linux-gnu/libgnutls.so.30+0xe7678) (BuildId: 97b8f99f392f1fd37b969a7164bcea884e23649b)
#4 0x5558ba470035 in test_tls_generate_cert tests/unit/crypto-tls-x509-helpers.c:234:5
#5 0x5558ba464e4a in test_migrate_tls_x509_start_common tests/qtest/migration-test.c:1058:5
#6 0x5558ba462c8a in test_migrate_tls_x509_start_default_host tests/qtest/migration-test.c:1123:12
#7 0x5558ba45ab40 in test_precopy_common tests/qtest/migration-test.c:1786:21
#8 0x5558ba450015 in test_precopy_unix_tls_x509_default_host tests/qtest/migration-test.c:2077:5
#9 0x5558ba46d3c7 in migration_test_wrapper tests/qtest/migration-helpers.c:456:5
(and similar reports).
The only function currently provided to deinit a QCryptoTLSCertReq is
test_tls_discard_cert(), which also removes the on-disk certificate
file. For the migration tests we need to retain the on-disk files
until we've finished running the test, so the simplest fix is to
provide a new function test_tls_deinit_cert() which does only the
cleanup of the QCryptoTLSCertReq, and call it in the right places.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
|
||
|---|---|---|
| .. | ||
| check-block-qdict.c | ||
| check-qdict.c | ||
| check-qjson.c | ||
| check-qlist.c | ||
| check-qlit.c | ||
| check-qnull.c | ||
| check-qnum.c | ||
| check-qobject.c | ||
| check-qom-interface.c | ||
| check-qom-proplist.c | ||
| check-qstring.c | ||
| crypto-tls-psk-helpers.c | ||
| crypto-tls-psk-helpers.h | ||
| crypto-tls-x509-helpers.c | ||
| crypto-tls-x509-helpers.h | ||
| io-channel-helpers.c | ||
| io-channel-helpers.h | ||
| iothread.c | ||
| iothread.h | ||
| meson.build | ||
| pkix_asn1_tab.c.inc | ||
| ptimer-test-stubs.c | ||
| ptimer-test.c | ||
| ptimer-test.h | ||
| rcutorture.c | ||
| socket-helpers.c | ||
| socket-helpers.h | ||
| test-aio-multithread.c | ||
| test-aio.c | ||
| test-authz-list.c | ||
| test-authz-listfile.c | ||
| test-authz-pam.c | ||
| test-authz-simple.c | ||
| test-base64.c | ||
| test-bdrv-drain.c | ||
| test-bdrv-graph-mod.c | ||
| test-bitcnt.c | ||
| test-bitmap.c | ||
| test-bitops.c | ||
| test-block-backend.c | ||
| test-block-iothread.c | ||
| test-blockjob-txn.c | ||
| test-blockjob.c | ||
| test-bufferiszero.c | ||
| test-char.c | ||
| test-clone-visitor.c | ||
| test-coroutine.c | ||
| test-crypto-afsplit.c | ||
| test-crypto-akcipher.c | ||
| test-crypto-block.c | ||
| test-crypto-cipher.c | ||
| test-crypto-der.c | ||
| test-crypto-hash.c | ||
| test-crypto-hmac.c | ||
| test-crypto-ivgen.c | ||
| test-crypto-pbkdf.c | ||
| test-crypto-secret.c | ||
| test-crypto-tlscredsx509.c | ||
| test-crypto-tlssession.c | ||
| test-crypto-xts.c | ||
| test-cutils.c | ||
| test-div128.c | ||
| test-error-report.c | ||
| test-forward-visitor.c | ||
| test-hbitmap.c | ||
| test-image-locking.c | ||
| test-int128.c | ||
| test-interval-tree.c | ||
| test-io-channel-buffer.c | ||
| test-io-channel-command.c | ||
| test-io-channel-file.c | ||
| test-io-channel-null.c | ||
| test-io-channel-socket.c | ||
| test-io-channel-tls.c | ||
| test-io-task.c | ||
| test-iov.c | ||
| test-keyval.c | ||
| test-logging.c | ||
| test-mul64.c | ||
| test-nested-aio-poll.c | ||
| test-opts-visitor.c | ||
| test-qapi-util.c | ||
| test-qdev-global-props.c | ||
| test-qdist.c | ||
| test-qemu-opts.c | ||
| test-qga.c | ||
| test-qgraph.c | ||
| test-qht.c | ||
| test-qmp-cmds.c | ||
| test-qmp-event.c | ||
| test-qobject-input-visitor.c | ||
| test-qobject-output-visitor.c | ||
| test-qtree.c | ||
| test-rcu-list.c | ||
| test-rcu-simpleq.c | ||
| test-rcu-slist.c | ||
| test-rcu-tailq.c | ||
| test-replication.c | ||
| test-resv-mem.c | ||
| test-seccomp.c | ||
| test-shift128.c | ||
| test-smp-parse.c | ||
| test-string-input-visitor.c | ||
| test-string-output-visitor.c | ||
| test-thread-pool.c | ||
| test-throttle.c | ||
| test-timed-average.c | ||
| test-util-filemonitor.c | ||
| test-util-sockets.c | ||
| test-uuid.c | ||
| test-virtio-dmabuf.c | ||
| test-visitor-serialization.c | ||
| test-vmstate.c | ||
| test-write-threshold.c | ||
| test-x86-topo.c | ||
| test-xbzrle.c | ||
| test-xs-node.c | ||
| test-yank.c | ||