qemu/tests
Peter Maydell 2cf6dc4101 tests/qtest/migration-test: Free QCRyptoTLSTestCertReq objects
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>
2024-09-03 16:24:34 -03:00
..
avocado Various fixes 2024-08-20 09:17:41 +10:00
bench tests/bench: Add bufferiszero-bench 2024-05-03 08:03:35 -07:00
data tests/acpi: Add expected ACPI AML files for RISC-V 2024-07-22 20:15:42 -04:00
decode tests/: spelling fixes 2023-09-08 13:08:52 +03:00
docker ci: refresh package lists with lcitool 2024-08-16 09:16:03 +02:00
fp tests/fp: Bump fp-test-mulAdd test timeout to 3 minutes 2024-01-12 13:23:48 +00:00
guest-debug tests: Gently exit from GDB when tests complete 2024-05-17 16:49:04 +02:00
image-fuzzer
include
keys
lcitool ci: add gtk-vnc to the deps 2024-08-16 09:16:03 +02:00
migration tests/qtest/migration-test: Use custom asm bios for ppc64 2024-06-14 14:01:23 -03:00
multiboot
perf/block/qcow2
qapi-schema qapi: remove "Example" doc section 2024-07-17 10:20:54 +02:00
qemu-iotests iotests/024: exclude 'backing file format' field from the output 2024-08-06 20:12:40 +02:00
qtest tests/qtest/migration-test: Free QCRyptoTLSTestCertReq objects 2024-09-03 16:24:34 -03:00
rocker
tcg target/i386: Fix carry flag for BLSI 2024-08-21 09:11:26 +10:00
tsan block: remove AioContext locking 2023-12-21 22:49:27 +01:00
uefi-test-tools tests/data/uefi-boot-images: Add RISC-V ISO image 2024-07-03 18:14:06 -04:00
unit tests/qtest/migration-test: Free QCRyptoTLSTestCertReq objects 2024-09-03 16:24:34 -03:00
vm ci: refresh package lists with lcitool 2024-08-16 09:16:03 +02:00
vmstate-static-checker-data
dbus-vmstate-daemon.sh
Makefile.include tests/avocado: Allow overwriting AVOCADO_SHOW env variable 2024-07-22 13:54:10 +02:00
meson.build tests/tcg: move test plugins into tcg subdir 2024-07-30 11:44:18 +01:00
test-qht-par.c
vhost-user-bridge.c error handling: Use RETRY_ON_EINTR() macro where applicable 2023-01-09 13:50:47 +01:00