* [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope @ 2019-07-23 15:48 Daniel P. Berrangé 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 1/3] glib: bump min required glib library version to 2.48 Daniel P. Berrangé ` (5 more replies) 0 siblings, 6 replies; 10+ messages in thread From: Daniel P. Berrangé @ 2019-07-23 15:48 UTC (permalink / raw) To: qemu-devel; +Cc: Daniel P. Berrangé Both GCC and CLang support a C extension attribute((cleanup)) which allows you to define a function that is invoked when a stack variable exits scope. This typically used to free the memory allocated to it, though you're not restricted to this. For example it could be used to unlock a mutex. We could use that functionality now, but the syntax is a bit ugly in plain C. Since version 2.44 of GLib, there have been a few macros to make it more friendly to use - g_autofree, g_autoptr and G_DEFINE_AUTOPTR_CLEANUP_FUNC. https://developer.gnome.org/glib/stable/glib-Miscellaneous-Macros.html https://blogs.gnome.org/desrt/2015/01/30/g_autoptr/ The key selling point is that it simplifies the cleanup code paths, often eliminating the need to goto cleanup labels. This improves the readability of the code and makes it less likely that you'll leak memory accidentally. Inspired by seeing it added to glib, and used in systemd, Libvirt finally got around to adopting this in Feb 2019. Overall our experience with it has been favourable/positive, with the code simplification being very nice. The main caveats with it are - Only works with GCC or CLang. We don't care as those are the only two compilers we declare support for. - You must always initialize the variables when declared to ensure predictable behaviour when they leave scope. Chances are most methods with goto jumps for cleanup are doing this already - You must not directly return the value that's assigned to a auto-cleaned variable. You must steal the pointer in some way. ie BAD: g_autofree char *wibble = g_strdup("wibble") .... return wibble; GOOD: g_autofree char *wibble = g_strdup("wibble") ... return g_steal_pointer(wibble); g_steal_pointer is an inline function which simply copies the pointer to a new variable, and sets the original variable to NULL, thus avoiding cleanup. I've illustrated the usage by converting a bunch of the crypto code in QEMU to use auto cleanup. Daniel P. Berrangé (3): glib: bump min required glib library version to 2.48 crypto: define cleanup functions for use with g_autoptr crypto: use auto cleanup for many stack variables configure | 2 +- crypto/afsplit.c | 28 ++++---------- crypto/block-luks.c | 74 +++++++++++-------------------------- crypto/block.c | 15 +++----- crypto/hmac-glib.c | 5 --- crypto/pbkdf.c | 5 +-- crypto/secret.c | 9 ++--- crypto/tlscredsanon.c | 16 +++----- crypto/tlscredspsk.c | 5 +-- crypto/tlscredsx509.c | 16 +++----- include/crypto/block.h | 2 + include/crypto/cipher.h | 2 + include/crypto/hmac.h | 2 + include/crypto/ivgen.h | 2 + include/crypto/tlssession.h | 2 + include/glib-compat.h | 42 +-------------------- 16 files changed, 66 insertions(+), 161 deletions(-) -- 2.21.0 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH for 4.2 1/3] glib: bump min required glib library version to 2.48 2019-07-23 15:48 [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope Daniel P. Berrangé @ 2019-07-23 15:48 ` Daniel P. Berrangé 2019-07-23 16:02 ` Thomas Huth 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 2/3] crypto: define cleanup functions for use with g_autoptr Daniel P. Berrangé ` (4 subsequent siblings) 5 siblings, 1 reply; 10+ messages in thread From: Daniel P. Berrangé @ 2019-07-23 15:48 UTC (permalink / raw) To: qemu-devel; +Cc: Thomas Huth, Daniel P. Berrangé Per supported platforms doc[1], the various min glib on relevant distros is: RHEL-8: 2.56.1 RHEL-7: 2.50.3 Debian (Buster): 2.58.3 Debian (Stretch): 2.50.3 OpenBSD (Ports): 2.58.3 FreeBSD (Ports): 2.56.3 OpenSUSE Leap 15: 2.54.3 SLE12-SP2: 2.48.2 Ubuntu (Xenial): 2.48.0 macOS (Homebrew): 2.56.0 This suggests that a minimum glib of 2.48 is a reasonable target. Compared to the previous version bump in commit e7b3af81597db1a6b55f2c15d030d703c6b2c6ac Author: Daniel P. Berrangé <berrange@redhat.com> Date: Fri May 4 15:34:46 2018 +0100 glib: bump min required glib library version to 2.40 This will result in us dropping support for Debian Jessie and Ubuntu 14.04. As per the commit message 14.04 was already outside our list of supported build platforms and an exception was only made because one of the build hosts used during merge testing was stuck on 14.04. Debian Jessie is justified to drop because we only aim to support at most 2 major versions of Debian at any time. This means Buster and Stretch at this time. The g_strv_contains compat code is dropped as this API is present since 2.44 The g_assert_cmpmem compat code is dropped as this API is present since 2.46 [1] https://qemu.weilnetz.de/doc/qemu-doc.html#Supported-build-platforms Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- configure | 2 +- crypto/hmac-glib.c | 5 ----- include/glib-compat.h | 42 ++---------------------------------------- 3 files changed, 3 insertions(+), 46 deletions(-) diff --git a/configure b/configure index 714e7fb6a1..22dc9c41db 100755 --- a/configure +++ b/configure @@ -3636,7 +3636,7 @@ fi ########################################## # glib support probe -glib_req_ver=2.40 +glib_req_ver=2.48 glib_modules=gthread-2.0 if test "$modules" = yes; then glib_modules="$glib_modules gmodule-export-2.0" diff --git a/crypto/hmac-glib.c b/crypto/hmac-glib.c index 7df627329d..509bbc74c2 100644 --- a/crypto/hmac-glib.c +++ b/crypto/hmac-glib.c @@ -21,12 +21,7 @@ static int qcrypto_hmac_alg_map[QCRYPTO_HASH_ALG__MAX] = { [QCRYPTO_HASH_ALG_MD5] = G_CHECKSUM_MD5, [QCRYPTO_HASH_ALG_SHA1] = G_CHECKSUM_SHA1, [QCRYPTO_HASH_ALG_SHA256] = G_CHECKSUM_SHA256, -/* Support for HMAC SHA-512 in GLib 2.42 */ -#if GLIB_CHECK_VERSION(2, 42, 0) [QCRYPTO_HASH_ALG_SHA512] = G_CHECKSUM_SHA512, -#else - [QCRYPTO_HASH_ALG_SHA512] = -1, -#endif [QCRYPTO_HASH_ALG_SHA224] = -1, [QCRYPTO_HASH_ALG_SHA384] = -1, [QCRYPTO_HASH_ALG_RIPEMD160] = -1, diff --git a/include/glib-compat.h b/include/glib-compat.h index 1291628e09..0b0ec76299 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -19,12 +19,12 @@ /* Ask for warnings for anything that was marked deprecated in * the defined version, or before. It is a candidate for rewrite. */ -#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_40 +#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_48 /* Ask for warnings if code tries to use function that did not * exist in the defined version. These risk breaking builds */ -#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_40 +#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_48 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -63,26 +63,6 @@ * without generating warnings. */ -static inline gboolean g_strv_contains_qemu(const gchar *const *strv, - const gchar *str) -{ -#if GLIB_CHECK_VERSION(2, 44, 0) - return g_strv_contains(strv, str); -#else - g_return_val_if_fail(strv != NULL, FALSE); - g_return_val_if_fail(str != NULL, FALSE); - - for (; *strv != NULL; strv++) { - if (g_str_equal(str, *strv)) { - return TRUE; - } - } - - return FALSE; -#endif -} -#define g_strv_contains(a, b) g_strv_contains_qemu(a, b) - #if defined(_WIN32) && !GLIB_CHECK_VERSION(2, 50, 0) /* * g_poll has a problem on Windows when using @@ -92,24 +72,6 @@ static inline gboolean g_strv_contains_qemu(const gchar *const *strv, gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout); #endif - -#ifndef g_assert_cmpmem -#define g_assert_cmpmem(m1, l1, m2, l2) \ - do { \ - gconstpointer __m1 = m1, __m2 = m2; \ - int __l1 = l1, __l2 = l2; \ - if (__l1 != __l2) { \ - g_assertion_message_cmpnum( \ - G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #l1 " (len(" #m1 ")) == " #l2 " (len(" #m2 "))", __l1, "==", \ - __l2, 'i'); \ - } else if (memcmp(__m1, __m2, __l1) != 0) { \ - g_assertion_message(G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - "assertion failed (" #m1 " == " #m2 ")"); \ - } \ - } while (0) -#endif - #pragma GCC diagnostic pop #endif -- 2.21.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.2 1/3] glib: bump min required glib library version to 2.48 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 1/3] glib: bump min required glib library version to 2.48 Daniel P. Berrangé @ 2019-07-23 16:02 ` Thomas Huth 2019-07-23 16:04 ` Daniel P. Berrangé 0 siblings, 1 reply; 10+ messages in thread From: Thomas Huth @ 2019-07-23 16:02 UTC (permalink / raw) To: Daniel P. Berrangé, qemu-devel On 23/07/2019 17.48, Daniel P. Berrangé wrote: > Per supported platforms doc[1], the various min glib on relevant distros is: > > RHEL-8: 2.56.1 > RHEL-7: 2.50.3 > Debian (Buster): 2.58.3 > Debian (Stretch): 2.50.3 > OpenBSD (Ports): 2.58.3 > FreeBSD (Ports): 2.56.3 > OpenSUSE Leap 15: 2.54.3 > SLE12-SP2: 2.48.2 > Ubuntu (Xenial): 2.48.0 > macOS (Homebrew): 2.56.0 > > This suggests that a minimum glib of 2.48 is a reasonable target. > > Compared to the previous version bump in > > commit e7b3af81597db1a6b55f2c15d030d703c6b2c6ac > Author: Daniel P. Berrangé <berrange@redhat.com> > Date: Fri May 4 15:34:46 2018 +0100 > > glib: bump min required glib library version to 2.40 > > This will result in us dropping support for Debian Jessie and > Ubuntu 14.04. > > As per the commit message 14.04 was already outside our list > of supported build platforms and an exception was only made > because one of the build hosts used during merge testing was > stuck on 14.04. > > Debian Jessie is justified to drop because we only aim to > support at most 2 major versions of Debian at any time. This > means Buster and Stretch at this time. > > The g_strv_contains compat code is dropped as this API is > present since 2.44 > > The g_assert_cmpmem compat code is dropped as this API is > present since 2.46 > > [1] https://qemu.weilnetz.de/doc/qemu-doc.html#Supported-build-platforms > > Reviewed-by: Thomas Huth <thuth@redhat.com> Sorry, my memory fails ... when did I review this patch? Thomas ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.2 1/3] glib: bump min required glib library version to 2.48 2019-07-23 16:02 ` Thomas Huth @ 2019-07-23 16:04 ` Daniel P. Berrangé 0 siblings, 0 replies; 10+ messages in thread From: Daniel P. Berrangé @ 2019-07-23 16:04 UTC (permalink / raw) To: Thomas Huth; +Cc: qemu-devel On Tue, Jul 23, 2019 at 06:02:43PM +0200, Thomas Huth wrote: > On 23/07/2019 17.48, Daniel P. Berrangé wrote: > > Per supported platforms doc[1], the various min glib on relevant distros is: > > > > RHEL-8: 2.56.1 > > RHEL-7: 2.50.3 > > Debian (Buster): 2.58.3 > > Debian (Stretch): 2.50.3 > > OpenBSD (Ports): 2.58.3 > > FreeBSD (Ports): 2.56.3 > > OpenSUSE Leap 15: 2.54.3 > > SLE12-SP2: 2.48.2 > > Ubuntu (Xenial): 2.48.0 > > macOS (Homebrew): 2.56.0 > > > > This suggests that a minimum glib of 2.48 is a reasonable target. > > > > Compared to the previous version bump in > > > > commit e7b3af81597db1a6b55f2c15d030d703c6b2c6ac > > Author: Daniel P. Berrangé <berrange@redhat.com> > > Date: Fri May 4 15:34:46 2018 +0100 > > > > glib: bump min required glib library version to 2.40 > > > > This will result in us dropping support for Debian Jessie and > > Ubuntu 14.04. > > > > As per the commit message 14.04 was already outside our list > > of supported build platforms and an exception was only made > > because one of the build hosts used during merge testing was > > stuck on 14.04. > > > > Debian Jessie is justified to drop because we only aim to > > support at most 2 major versions of Debian at any time. This > > means Buster and Stretch at this time. > > > > The g_strv_contains compat code is dropped as this API is > > present since 2.44 > > > > The g_assert_cmpmem compat code is dropped as this API is > > present since 2.46 > > > > [1] https://qemu.weilnetz.de/doc/qemu-doc.html#Supported-build-platforms > > > > Reviewed-by: Thomas Huth <thuth@redhat.com> > > Sorry, my memory fails ... when did I review this patch? Doh, sorry - cut & paste screwup. I'll drop this line. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH for 4.2 2/3] crypto: define cleanup functions for use with g_autoptr 2019-07-23 15:48 [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope Daniel P. Berrangé 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 1/3] glib: bump min required glib library version to 2.48 Daniel P. Berrangé @ 2019-07-23 15:48 ` Daniel P. Berrangé 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 3/3] crypto: use auto cleanup for many stack variables Daniel P. Berrangé ` (3 subsequent siblings) 5 siblings, 0 replies; 10+ messages in thread From: Daniel P. Berrangé @ 2019-07-23 15:48 UTC (permalink / raw) To: qemu-devel; +Cc: Daniel P. Berrangé Allow crypto structs to be used with g_autoptr, avoiding the need to explicitly call XXX_free() functions when variables go out of scope on the stack. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- include/crypto/block.h | 2 ++ include/crypto/cipher.h | 2 ++ include/crypto/hmac.h | 2 ++ include/crypto/ivgen.h | 2 ++ include/crypto/tlssession.h | 2 ++ 5 files changed, 10 insertions(+) diff --git a/include/crypto/block.h b/include/crypto/block.h index fe12899831..d49d2c2da9 100644 --- a/include/crypto/block.h +++ b/include/crypto/block.h @@ -268,4 +268,6 @@ uint64_t qcrypto_block_get_sector_size(QCryptoBlock *block); */ void qcrypto_block_free(QCryptoBlock *block); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlock, qcrypto_block_free) + #endif /* QCRYPTO_BLOCK_H */ diff --git a/include/crypto/cipher.h b/include/crypto/cipher.h index cac90b410c..5928e5ecc7 100644 --- a/include/crypto/cipher.h +++ b/include/crypto/cipher.h @@ -170,6 +170,8 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg, */ void qcrypto_cipher_free(QCryptoCipher *cipher); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoCipher, qcrypto_cipher_free) + /** * qcrypto_cipher_encrypt: * @cipher: the cipher object diff --git a/include/crypto/hmac.h b/include/crypto/hmac.h index aa3c97a2ff..ad4d778416 100644 --- a/include/crypto/hmac.h +++ b/include/crypto/hmac.h @@ -65,6 +65,8 @@ QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg, */ void qcrypto_hmac_free(QCryptoHmac *hmac); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoHmac, qcrypto_hmac_free) + /** * qcrypto_hmac_bytesv: * @hmac: the hmac object diff --git a/include/crypto/ivgen.h b/include/crypto/ivgen.h index 9b4a62f7bb..e41521519c 100644 --- a/include/crypto/ivgen.h +++ b/include/crypto/ivgen.h @@ -203,4 +203,6 @@ QCryptoHashAlgorithm qcrypto_ivgen_get_hash(QCryptoIVGen *ivgen); */ void qcrypto_ivgen_free(QCryptoIVGen *ivgen); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoIVGen, qcrypto_ivgen_free) + #endif /* QCRYPTO_IVGEN_H */ diff --git a/include/crypto/tlssession.h b/include/crypto/tlssession.h index 816300cdcc..e01e1a9dc2 100644 --- a/include/crypto/tlssession.h +++ b/include/crypto/tlssession.h @@ -160,6 +160,8 @@ QCryptoTLSSession *qcrypto_tls_session_new(QCryptoTLSCreds *creds, */ void qcrypto_tls_session_free(QCryptoTLSSession *sess); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSSession, qcrypto_tls_session_free) + /** * qcrypto_tls_session_check_credentials: * @sess: the TLS session object -- 2.21.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Qemu-devel] [PATCH for 4.2 3/3] crypto: use auto cleanup for many stack variables 2019-07-23 15:48 [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope Daniel P. Berrangé 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 1/3] glib: bump min required glib library version to 2.48 Daniel P. Berrangé 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 2/3] crypto: define cleanup functions for use with g_autoptr Daniel P. Berrangé @ 2019-07-23 15:48 ` Daniel P. Berrangé 2019-07-23 19:17 ` [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope no-reply ` (2 subsequent siblings) 5 siblings, 0 replies; 10+ messages in thread From: Daniel P. Berrangé @ 2019-07-23 15:48 UTC (permalink / raw) To: qemu-devel; +Cc: Daniel P. Berrangé Simplify cleanup paths by using glib's auto cleanup macros for stack variables, allowing several goto jumps / labels to be eliminated. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- crypto/afsplit.c | 28 +++++----------- crypto/block-luks.c | 74 +++++++++++++------------------------------ crypto/block.c | 15 +++------ crypto/pbkdf.c | 5 +-- crypto/secret.c | 9 +++--- crypto/tlscredsanon.c | 16 ++++------ crypto/tlscredspsk.c | 5 ++- crypto/tlscredsx509.c | 16 +++------- 8 files changed, 53 insertions(+), 115 deletions(-) diff --git a/crypto/afsplit.c b/crypto/afsplit.c index 328d68c96b..b1a5a20899 100644 --- a/crypto/afsplit.c +++ b/crypto/afsplit.c @@ -58,7 +58,7 @@ static int qcrypto_afsplit_hash(QCryptoHashAlgorithm hash, } for (i = 0; i < hashcount; i++) { - uint8_t *out = NULL; + g_autofree uint8_t *out = NULL; size_t outlen = 0; uint32_t iv = cpu_to_be32(i); struct iovec in[] = { @@ -79,7 +79,6 @@ static int qcrypto_afsplit_hash(QCryptoHashAlgorithm hash, assert(outlen == digestlen); memcpy(block + (i * digestlen), out, (i == (hashcount - 1)) ? finallen : digestlen); - g_free(out); } return 0; @@ -93,13 +92,12 @@ int qcrypto_afsplit_encode(QCryptoHashAlgorithm hash, uint8_t *out, Error **errp) { - uint8_t *block = g_new0(uint8_t, blocklen); + g_autofree uint8_t *block = g_new0(uint8_t, blocklen); size_t i; - int ret = -1; for (i = 0; i < (stripes - 1); i++) { if (qcrypto_random_bytes(out + (i * blocklen), blocklen, errp) < 0) { - goto cleanup; + return -1; } qcrypto_afsplit_xor(blocklen, @@ -108,18 +106,14 @@ int qcrypto_afsplit_encode(QCryptoHashAlgorithm hash, block); if (qcrypto_afsplit_hash(hash, blocklen, block, errp) < 0) { - goto cleanup; + return -1; } } qcrypto_afsplit_xor(blocklen, in, block, out + (i * blocklen)); - ret = 0; - - cleanup: - g_free(block); - return ret; + return 0; } @@ -130,9 +124,8 @@ int qcrypto_afsplit_decode(QCryptoHashAlgorithm hash, uint8_t *out, Error **errp) { - uint8_t *block = g_new0(uint8_t, blocklen); + g_autofree uint8_t *block = g_new0(uint8_t, blocklen); size_t i; - int ret = -1; for (i = 0; i < (stripes - 1); i++) { qcrypto_afsplit_xor(blocklen, @@ -141,7 +134,7 @@ int qcrypto_afsplit_decode(QCryptoHashAlgorithm hash, block); if (qcrypto_afsplit_hash(hash, blocklen, block, errp) < 0) { - goto cleanup; + return -1; } } @@ -149,10 +142,5 @@ int qcrypto_afsplit_decode(QCryptoHashAlgorithm hash, in + (i * blocklen), block, out); - - ret = 0; - - cleanup: - g_free(block); - return ret; + return 0; } diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 409ab50f20..c8e0a0caa4 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -425,14 +425,13 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, Error **errp) { QCryptoBlockLUKS *luks = block->opaque; - uint8_t *splitkey; + g_autofree uint8_t *splitkey = NULL; size_t splitkeylen; - uint8_t *possiblekey; - int ret = -1; + g_autofree uint8_t *possiblekey = NULL; ssize_t rv; - QCryptoCipher *cipher = NULL; + g_autoptr(QCryptoCipher) cipher = NULL; uint8_t keydigest[QCRYPTO_BLOCK_LUKS_DIGEST_LEN]; - QCryptoIVGen *ivgen = NULL; + g_autoptr(QCryptoIVGen) ivgen = NULL; size_t niv; if (slot->active != QCRYPTO_BLOCK_LUKS_KEY_SLOT_ENABLED) { @@ -456,7 +455,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, slot->iterations, possiblekey, masterkeylen, errp) < 0) { - goto cleanup; + return -1; } /* @@ -472,7 +471,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, opaque, errp); if (rv < 0) { - goto cleanup; + return -1; } @@ -482,7 +481,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, possiblekey, masterkeylen, errp); if (!cipher) { - goto cleanup; + return -1; } niv = qcrypto_cipher_get_iv_len(cipheralg, @@ -493,7 +492,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, possiblekey, masterkeylen, errp); if (!ivgen) { - goto cleanup; + return -1; } @@ -512,7 +511,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, splitkey, splitkeylen, errp) < 0) { - goto cleanup; + return -1; } /* @@ -525,7 +524,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, splitkey, masterkey, errp) < 0) { - goto cleanup; + return -1; } @@ -544,26 +543,18 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, luks->header.master_key_iterations, keydigest, G_N_ELEMENTS(keydigest), errp) < 0) { - goto cleanup; + return -1; } if (memcmp(keydigest, luks->header.master_key_digest, QCRYPTO_BLOCK_LUKS_DIGEST_LEN) == 0) { /* Success, we got the right master key */ - ret = 1; - goto cleanup; + return 1; } /* Fail, user's password was not valid for this key slot, * tell caller to try another slot */ - ret = 0; - - cleanup: - qcrypto_ivgen_free(ivgen); - qcrypto_cipher_free(cipher); - g_free(splitkey); - g_free(possiblekey); - return ret; + return 0; } @@ -644,7 +635,7 @@ qcrypto_block_luks_open(QCryptoBlock *block, int ret = 0; size_t i; ssize_t rv; - uint8_t *masterkey = NULL; + g_autofree uint8_t *masterkey = NULL; size_t masterkeylen; char *ivgen_name, *ivhash_name; QCryptoCipherMode ciphermode; @@ -653,7 +644,7 @@ qcrypto_block_luks_open(QCryptoBlock *block, QCryptoCipherAlgorithm ivcipheralg; QCryptoHashAlgorithm hash; QCryptoHashAlgorithm ivhash; - char *password = NULL; + g_autofree char *password = NULL; if (!(flags & QCRYPTO_BLOCK_OPEN_NO_IO)) { if (!options->u.luks.key_secret) { @@ -856,17 +847,12 @@ qcrypto_block_luks_open(QCryptoBlock *block, luks->ivgen_hash_alg = ivhash; luks->hash_alg = hash; - g_free(masterkey); - g_free(password); - return 0; fail: - g_free(masterkey); qcrypto_block_free_cipher(block); qcrypto_ivgen_free(block->ivgen); g_free(luks); - g_free(password); return ret; } @@ -891,20 +877,20 @@ qcrypto_block_luks_create(QCryptoBlock *block, QCryptoBlockLUKS *luks; QCryptoBlockCreateOptionsLUKS luks_opts; Error *local_err = NULL; - uint8_t *masterkey = NULL; - uint8_t *slotkey = NULL; - uint8_t *splitkey = NULL; + g_autofree uint8_t *masterkey = NULL; + g_autofree uint8_t *slotkey = NULL; + g_autofree uint8_t *splitkey = NULL; size_t splitkeylen = 0; size_t i; - QCryptoCipher *cipher = NULL; - QCryptoIVGen *ivgen = NULL; - char *password; + g_autoptr(QCryptoCipher) cipher = NULL; + g_autoptr(QCryptoIVGen) ivgen = NULL; + g_autofree char *password; const char *cipher_alg; const char *cipher_mode; const char *ivgen_alg; const char *ivgen_hash_alg = NULL; const char *hash_alg; - char *cipher_mode_spec = NULL; + g_autofree char *cipher_mode_spec = NULL; QCryptoCipherAlgorithm ivcipheralg = 0; uint64_t iters; @@ -1311,15 +1297,7 @@ qcrypto_block_luks_create(QCryptoBlock *block, luks->hash_alg = luks_opts.hash_alg; memset(masterkey, 0, luks->header.key_bytes); - g_free(masterkey); memset(slotkey, 0, luks->header.key_bytes); - g_free(slotkey); - g_free(splitkey); - g_free(password); - g_free(cipher_mode_spec); - - qcrypto_ivgen_free(ivgen); - qcrypto_cipher_free(cipher); return 0; @@ -1327,17 +1305,9 @@ qcrypto_block_luks_create(QCryptoBlock *block, if (masterkey) { memset(masterkey, 0, luks->header.key_bytes); } - g_free(masterkey); if (slotkey) { memset(slotkey, 0, luks->header.key_bytes); } - g_free(slotkey); - g_free(splitkey); - g_free(password); - g_free(cipher_mode_spec); - - qcrypto_ivgen_free(ivgen); - qcrypto_cipher_free(cipher); qcrypto_block_free_cipher(block); qcrypto_ivgen_free(block->ivgen); diff --git a/crypto/block.c b/crypto/block.c index ee96759f7d..325752871c 100644 --- a/crypto/block.c +++ b/crypto/block.c @@ -299,15 +299,13 @@ static int do_qcrypto_block_cipher_encdec(QCryptoCipher *cipher, QCryptoCipherEncDecFunc func, Error **errp) { - uint8_t *iv; + g_autofree uint8_t *iv = niv ? g_new0(uint8_t, niv) : NULL; int ret = -1; uint64_t startsector = offset / sectorsize; assert(QEMU_IS_ALIGNED(offset, sectorsize)); assert(QEMU_IS_ALIGNED(len, sectorsize)); - iv = niv ? g_new0(uint8_t, niv) : NULL; - while (len > 0) { size_t nbytes; if (niv) { @@ -320,19 +318,19 @@ static int do_qcrypto_block_cipher_encdec(QCryptoCipher *cipher, } if (ret < 0) { - goto cleanup; + return -1; } if (qcrypto_cipher_setiv(cipher, iv, niv, errp) < 0) { - goto cleanup; + return -1; } } nbytes = len > sectorsize ? sectorsize : len; if (func(cipher, buf, buf, nbytes, errp) < 0) { - goto cleanup; + return -1; } startsector++; @@ -340,10 +338,7 @@ static int do_qcrypto_block_cipher_encdec(QCryptoCipher *cipher, len -= nbytes; } - ret = 0; - cleanup: - g_free(iv); - return ret; + return 0; } diff --git a/crypto/pbkdf.c b/crypto/pbkdf.c index b7c7c4a59b..3775ddc6c5 100644 --- a/crypto/pbkdf.c +++ b/crypto/pbkdf.c @@ -69,12 +69,10 @@ uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash, Error **errp) { uint64_t ret = -1; - uint8_t *out; + g_autofree uint8_t *out = g_new(uint8_t, nout); uint64_t iterations = (1 << 15); unsigned long long delta_ms, start_ms, end_ms; - out = g_new(uint8_t, nout); - while (1) { if (qcrypto_pbkdf2_get_thread_cpu(&start_ms, errp) < 0) { goto cleanup; @@ -108,6 +106,5 @@ uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash, cleanup: memset(out, 0, nout); - g_free(out); return ret; } diff --git a/crypto/secret.c b/crypto/secret.c index a75d50ae0c..aeb506afab 100644 --- a/crypto/secret.c +++ b/crypto/secret.c @@ -72,9 +72,11 @@ static void qcrypto_secret_decrypt(QCryptoSecret *secret, size_t *outputlen, Error **errp) { - uint8_t *key = NULL, *ciphertext = NULL, *iv = NULL; + g_autofree uint8_t *key = NULL; + g_autofree uint8_t *ciphertext = NULL; + g_autofree uint8_t *iv = NULL; size_t keylen, ciphertextlen, ivlen; - QCryptoCipher *aes = NULL; + g_autoptr(QCryptoCipher) aes = NULL; uint8_t *plaintext = NULL; *output = NULL; @@ -160,9 +162,6 @@ static void qcrypto_secret_decrypt(QCryptoSecret *secret, *outputlen = ciphertextlen; cleanup: - g_free(ciphertext); - g_free(iv); - g_free(key); qcrypto_cipher_free(aes); } diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c index d2adc7c131..a235f60146 100644 --- a/crypto/tlscredsanon.c +++ b/crypto/tlscredsanon.c @@ -34,9 +34,8 @@ static int qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds, Error **errp) { - char *dhparams = NULL; + g_autofree char *dhparams = NULL; int ret; - int rv = -1; trace_qcrypto_tls_creds_anon_load(creds, creds->parent_obj.dir ? creds->parent_obj.dir : "<nodir>"); @@ -45,20 +44,20 @@ qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds, if (qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_DH_PARAMS, false, &dhparams, errp) < 0) { - goto cleanup; + return -1; } ret = gnutls_anon_allocate_server_credentials(&creds->data.server); if (ret < 0) { error_setg(errp, "Cannot allocate credentials: %s", gnutls_strerror(ret)); - goto cleanup; + return -1; } if (qcrypto_tls_creds_get_dh_params_file(&creds->parent_obj, dhparams, &creds->parent_obj.dh_params, errp) < 0) { - goto cleanup; + return -1; } gnutls_anon_set_server_dh_params(creds->data.server, @@ -68,14 +67,11 @@ qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds, if (ret < 0) { error_setg(errp, "Cannot allocate credentials: %s", gnutls_strerror(ret)); - goto cleanup; + return -1; } } - rv = 0; - cleanup: - g_free(dhparams); - return rv; + return 0; } diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c index 4b6cf636ce..15d12e2448 100644 --- a/crypto/tlscredspsk.c +++ b/crypto/tlscredspsk.c @@ -69,7 +69,8 @@ static int qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds, Error **errp) { - char *pskfile = NULL, *dhparams = NULL; + g_autofree char *pskfile = NULL; + g_autofree char *dhparams = NULL; const char *username; int ret; int rv = -1; @@ -139,8 +140,6 @@ qcrypto_tls_creds_psk_load(QCryptoTLSCredsPSK *creds, rv = 0; cleanup: g_free(key.data); - g_free(pskfile); - g_free(dhparams); return rv; } diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c index 56dcef3673..01fc304e5d 100644 --- a/crypto/tlscredsx509.c +++ b/crypto/tlscredsx509.c @@ -378,7 +378,7 @@ qcrypto_tls_creds_load_cert(QCryptoTLSCredsX509 *creds, { gnutls_datum_t data; gnutls_x509_crt_t cert = NULL; - char *buf = NULL; + g_autofree char *buf = NULL; gsize buflen; GError *gerr; int ret = -1; @@ -420,7 +420,6 @@ qcrypto_tls_creds_load_cert(QCryptoTLSCredsX509 *creds, gnutls_x509_crt_deinit(cert); cert = NULL; } - g_free(buf); return cert; } @@ -434,9 +433,8 @@ qcrypto_tls_creds_load_ca_cert_list(QCryptoTLSCredsX509 *creds, Error **errp) { gnutls_datum_t data; - char *buf = NULL; + g_autofree char *buf = NULL; gsize buflen; - int ret = -1; GError *gerr = NULL; *ncerts = 0; @@ -446,7 +444,7 @@ qcrypto_tls_creds_load_ca_cert_list(QCryptoTLSCredsX509 *creds, error_setg(errp, "Cannot load CA cert list %s: %s", certFile, gerr->message); g_error_free(gerr); - goto cleanup; + return -1; } data.data = (unsigned char *)buf; @@ -457,15 +455,11 @@ qcrypto_tls_creds_load_ca_cert_list(QCryptoTLSCredsX509 *creds, error_setg(errp, "Unable to import CA certificate list %s", certFile); - goto cleanup; + return -1; } *ncerts = certMax; - ret = 0; - - cleanup: - g_free(buf); - return ret; + return 0; } -- 2.21.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope 2019-07-23 15:48 [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope Daniel P. Berrangé ` (2 preceding siblings ...) 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 3/3] crypto: use auto cleanup for many stack variables Daniel P. Berrangé @ 2019-07-23 19:17 ` no-reply 2019-07-25 8:38 ` Stefan Hajnoczi 2019-07-25 9:13 ` Peter Maydell 5 siblings, 0 replies; 10+ messages in thread From: no-reply @ 2019-07-23 19:17 UTC (permalink / raw) To: berrange; +Cc: berrange, qemu-devel Patchew URL: https://patchew.org/QEMU/20190723154856.17348-1-berrange@redhat.com/ Hi, This series failed the asan build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. === TEST SCRIPT BEGIN === #!/bin/bash make docker-image-fedora V=1 NETWORK=1 time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1 === TEST SCRIPT END === PASS 32 test-opts-visitor /visitor/opts/range/beyond PASS 33 test-opts-visitor /visitor/opts/dict/unvisited MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-coroutine -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-coroutine" ==13077==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-coroutine /basic/no-dangling-access ==13077==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffd239e2000; bottom 0x7f320f2f8000; size: 0x00cb146ea000 (872221155328) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 2 test-coroutine /basic/lifecycle --- PASS 1 fdc-test /x86_64/fdc/cmos PASS 2 fdc-test /x86_64/fdc/no_media_on_start PASS 3 fdc-test /x86_64/fdc/read_without_media ==13111==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 4 fdc-test /x86_64/fdc/media_change PASS 5 fdc-test /x86_64/fdc/sense_interrupt PASS 6 fdc-test /x86_64/fdc/relative_seek --- PASS 9 fdc-test /x86_64/fdc/media_insert PASS 10 fdc-test /x86_64/fdc/read_no_dma_1 PASS 14 test-aio /aio/timer/schedule ==13106==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 15 test-aio /aio/coroutine/queue-chaining PASS 16 test-aio /aio-gsource/flush PASS 17 test-aio /aio-gsource/bh/schedule --- PASS 28 test-aio /aio-gsource/timer/schedule MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-aio-multithread -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-aio-multithread" PASS 1 test-aio-multithread /aio/multi/lifecycle ==13120==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 11 fdc-test /x86_64/fdc/read_no_dma_18 PASS 2 test-aio-multithread /aio/multi/schedule PASS 3 test-aio-multithread /aio/multi/mutex/contended --- PASS 4 test-aio-multithread /aio/multi/mutex/handoff MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/ide-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="ide-test" PASS 5 test-aio-multithread /aio/multi/mutex/mcs ==13154==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 ide-test /x86_64/ide/identify PASS 6 test-aio-multithread /aio/multi/mutex/pthread ==13165==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-throttle -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-throttle" PASS 2 ide-test /x86_64/ide/flush PASS 1 test-throttle /throttle/leak_bucket --- PASS 6 test-throttle /throttle/detach_attach PASS 7 test-throttle /throttle/config_functions PASS 8 test-throttle /throttle/accounting ==13172==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 9 test-throttle /throttle/groups PASS 10 test-throttle /throttle/config/enabled PASS 11 test-throttle /throttle/config/conflicting --- PASS 13 test-throttle /throttle/config/ranges PASS 14 test-throttle /throttle/config/max PASS 15 test-throttle /throttle/config/iops_size ==13175==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-thread-pool -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-thread-pool" PASS 3 ide-test /x86_64/ide/bmdma/simple_rw PASS 1 test-thread-pool /thread-pool/submit PASS 2 test-thread-pool /thread-pool/submit-aio ==13184==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 test-thread-pool /thread-pool/submit-co PASS 4 test-thread-pool /thread-pool/submit-many ==13186==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 4 ide-test /x86_64/ide/bmdma/trim ==13257==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 5 test-thread-pool /thread-pool/cancel PASS 5 ide-test /x86_64/ide/bmdma/short_prdt ==13263==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 6 ide-test /x86_64/ide/bmdma/one_sector_short_prdt PASS 6 test-thread-pool /thread-pool/cancel-async MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-hbitmap -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-hbitmap" --- PASS 2 test-hbitmap /hbitmap/size/0 PASS 3 test-hbitmap /hbitmap/size/unaligned PASS 4 test-hbitmap /hbitmap/iter/empty ==13269==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 7 ide-test /x86_64/ide/bmdma/long_prdt PASS 5 test-hbitmap /hbitmap/iter/partial PASS 6 test-hbitmap /hbitmap/iter/granularity --- PASS 12 test-hbitmap /hbitmap/set/two-elem PASS 13 test-hbitmap /hbitmap/set/general PASS 14 test-hbitmap /hbitmap/set/twice ==13280==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 15 test-hbitmap /hbitmap/set/overlap PASS 16 test-hbitmap /hbitmap/reset/empty ==13280==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe002a9000; bottom 0x7f7b069fe000; size: 0x0082f98ab000 (562532364288) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 17 test-hbitmap /hbitmap/reset/general --- PASS 29 test-hbitmap /hbitmap/truncate/shrink/large PASS 30 test-hbitmap /hbitmap/meta/zero PASS 9 ide-test /x86_64/ide/flush/nodev ==13291==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 10 ide-test /x86_64/ide/flush/empty_drive ==13296==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 11 ide-test /x86_64/ide/flush/retry_pci ==13302==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 31 test-hbitmap /hbitmap/meta/one PASS 32 test-hbitmap /hbitmap/meta/byte PASS 33 test-hbitmap /hbitmap/meta/word PASS 12 ide-test /x86_64/ide/flush/retry_isa ==13308==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 34 test-hbitmap /hbitmap/meta/sector PASS 35 test-hbitmap /hbitmap/serialize/align PASS 13 ide-test /x86_64/ide/cdrom/pio ==13314==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 36 test-hbitmap /hbitmap/serialize/basic PASS 37 test-hbitmap /hbitmap/serialize/part PASS 38 test-hbitmap /hbitmap/serialize/zeroes --- PASS 42 test-hbitmap /hbitmap/next_dirty_area/next_dirty_area_1 PASS 43 test-hbitmap /hbitmap/next_dirty_area/next_dirty_area_4 MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-bdrv-drain -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-bdrv-drain" ==13321==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 14 ide-test /x86_64/ide/cdrom/pio_large PASS 1 test-bdrv-drain /bdrv-drain/nested PASS 2 test-bdrv-drain /bdrv-drain/multiparent --- PASS 29 test-bdrv-drain /bdrv-drain/blockjob/iothread/drain PASS 30 test-bdrv-drain /bdrv-drain/blockjob/iothread/drain_subtree PASS 31 test-bdrv-drain /bdrv-drain/blockjob/iothread/error/drain_all ==13326==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 32 test-bdrv-drain /bdrv-drain/blockjob/iothread/error/drain PASS 33 test-bdrv-drain /bdrv-drain/blockjob/iothread/error/drain_subtree PASS 34 test-bdrv-drain /bdrv-drain/deletion/drain --- PASS 15 ide-test /x86_64/ide/cdrom/dma MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/ahci-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="ahci-test" MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-bdrv-graph-mod -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-bdrv-graph-mod" ==13373==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-bdrv-graph-mod /bdrv-graph-mod/update-perm-tree PASS 2 test-bdrv-graph-mod /bdrv-graph-mod/should-update-child MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-blockjob -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-blockjob" ==13382==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-blockjob /blockjob/ids PASS 2 test-blockjob /blockjob/cancel/created PASS 3 test-blockjob /blockjob/cancel/running --- PASS 5 test-blockjob /blockjob/cancel/ready PASS 6 test-blockjob /blockjob/cancel/standby PASS 7 test-blockjob /blockjob/cancel/pending ==13380==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 8 test-blockjob /blockjob/cancel/concluded MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-blockjob-txn -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-blockjob-txn" ==13391==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-blockjob-txn /single/success PASS 2 test-blockjob-txn /single/failure PASS 3 test-blockjob-txn /single/cancel --- PASS 7 test-blockjob-txn /pair/fail-cancel-race MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-block-backend -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-block-backend" PASS 1 ahci-test /x86_64/ahci/sanity ==13398==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-block-backend /block-backend/drain_aio_error PASS 2 test-block-backend /block-backend/drain_all_aio_error ==13397==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-block-iothread -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-block-iothread" ==13407==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-block-iothread /sync-op/pread PASS 2 test-block-iothread /sync-op/pwrite PASS 3 test-block-iothread /sync-op/load_vmstate --- PASS 16 test-block-iothread /propagate/mirror PASS 2 ahci-test /x86_64/ahci/pci_spec MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-image-locking -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-image-locking" ==13428==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13430==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-image-locking /image-locking/basic PASS 2 test-image-locking /image-locking/set-perm-abort MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-x86-cpuid -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-x86-cpuid" --- PASS 3 test-xbzrle /xbzrle/encode_decode_unchanged PASS 4 test-xbzrle /xbzrle/encode_decode_1_byte PASS 5 test-xbzrle /xbzrle/encode_decode_overflow ==13443==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 6 test-xbzrle /xbzrle/encode_decode MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-vmstate -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-vmstate" PASS 1 test-vmstate /vmstate/tmp_struct --- PASS 2 rcutorture /rcu/torture/10readers MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-rcu-list -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-rcu-list" PASS 1 test-rcu-list /rcu/qlist/single-threaded ==13462==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 2 test-rcu-list /rcu/qlist/short-few PASS 5 ahci-test /x86_64/ahci/hba_enable ==13541==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 6 ahci-test /x86_64/ahci/identify PASS 3 test-rcu-list /rcu/qlist/long-many MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-rcu-simpleq -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-rcu-simpleq" ==13547==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-rcu-simpleq /rcu/qsimpleq/single-threaded PASS 7 ahci-test /x86_64/ahci/max PASS 2 test-rcu-simpleq /rcu/qsimpleq/short-few ==13566==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 test-rcu-simpleq /rcu/qsimpleq/long-many MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-rcu-tailq -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-rcu-tailq" PASS 8 ahci-test /x86_64/ahci/reset ==13597==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13597==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc9256e000; bottom 0x7f420e9fe000; size: 0x00ba83b70000 (801073725440) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 1 test-rcu-tailq /rcu/qtailq/single-threaded PASS 2 test-rcu-tailq /rcu/qtailq/short-few PASS 9 ahci-test /x86_64/ahci/io/pio/lba28/simple/zero ==13633==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 test-rcu-tailq /rcu/qtailq/long-many MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qdist -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qdist" ==13633==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff94291000; bottom 0x7fa8649fe000; size: 0x00572f893000 (374459674624) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 1 test-qdist /qdist/none --- PASS 8 test-qdist /qdist/binning/shrink MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qht -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qht" PASS 10 ahci-test /x86_64/ahci/io/pio/lba28/simple/low ==13648==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13648==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffeedbf4000; bottom 0x7f7c215fe000; size: 0x0082cc5f6000 (561774551040) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 11 ahci-test /x86_64/ahci/io/pio/lba28/simple/high ==13654==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13654==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe295c6000; bottom 0x7fb9f89fe000; size: 0x004430bc8000 (292875436032) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 12 ahci-test /x86_64/ahci/io/pio/lba28/double/zero ==13660==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13660==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe05a7f000; bottom 0x7f87573fe000; size: 0x0076ae681000 (509732196352) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 13 ahci-test /x86_64/ahci/io/pio/lba28/double/low ==13666==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13666==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffcf53c4000; bottom 0x7f76c2dfe000; size: 0x0086325c6000 (576370532352) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 14 ahci-test /x86_64/ahci/io/pio/lba28/double/high ==13672==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13672==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffcaa48a000; bottom 0x7f89d63fe000; size: 0x0072d408c000 (493183614976) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 15 ahci-test /x86_64/ahci/io/pio/lba28/long/zero ==13678==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13678==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc35df0000; bottom 0x7f5580dfe000; size: 0x00a6b4ff2000 (716001189888) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 16 ahci-test /x86_64/ahci/io/pio/lba28/long/low ==13684==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13684==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff97725000; bottom 0x7f7f61b7c000; size: 0x008035ba9000 (550657232896) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 17 ahci-test /x86_64/ahci/io/pio/lba28/long/high ==13690==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 18 ahci-test /x86_64/ahci/io/pio/lba28/short/zero ==13696==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-qht /qht/mode/default PASS 2 test-qht /qht/mode/resize MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qht-par -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qht-par" PASS 19 ahci-test /x86_64/ahci/io/pio/lba28/short/low ==13708==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 20 ahci-test /x86_64/ahci/io/pio/lba28/short/high PASS 1 test-qht-par /qht/parallel/2threads-0%updates-1s ==13718==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13718==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff3d141000; bottom 0x7f9dddbfe000; size: 0x00615f543000 (418211180544) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 2 test-qht-par /qht/parallel/2threads-20%updates-1s --- PASS 3 test-bitcnt /bitcnt/ctpop32 PASS 4 test-bitcnt /bitcnt/ctpop64 MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qdev-global-props -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qdev-global-props" ==13736==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-qdev-global-props /qdev/properties/static/default PASS 2 test-qdev-global-props /qdev/properties/static/global PASS 3 test-qdev-global-props /qdev/properties/dynamic/global PASS 4 test-qdev-global-props /qdev/properties/global/subclass MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/check-qom-interface -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="check-qom-interface" ==13736==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffcd2e89000; bottom 0x7f77fc5fe000; size: 0x0084d688b000 (570534965248) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 1 check-qom-interface /qom/interface/direct_impl --- PASS 9 test-keyval /keyval/visit/alternate PASS 10 test-keyval /keyval/visit/any MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-write-threshold -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-write-threshold" ==13769==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 test-write-threshold /write-threshold/not-set-on-init PASS 2 test-write-threshold /write-threshold/set-get PASS 3 test-write-threshold /write-threshold/multi-set-get PASS 4 test-write-threshold /write-threshold/not-trigger PASS 5 test-write-threshold /write-threshold/trigger ==13769==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffcda926000; bottom 0x7efe583fe000; size: 0x00fe82528000 (1093108137984) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-crypto-hash -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-crypto-hash" --- PASS 28 test-crypto-cipher /crypto/cipher/short-plaintext MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-crypto-secret -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-crypto-secret" ================================================================= ==13802==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000004730 at pc 0x55a39f1ba823 bp 0x7fff4f477650 sp 0x7fff4f477648 READ of size 8 at 0x603000004730 thread T0 PASS 1 test-crypto-secret /crypto/secret/direct PASS 2 test-crypto-secret /crypto/secret/indirect/good --- PASS 8 test-crypto-secret /crypto/secret/conv/base64/utf8valid PASS 9 test-crypto-secret /crypto/secret/conv/base64/utf8invalid PASS 10 test-crypto-secret /crypto/secret/conv/utf8/base64 ==13798==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13798==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffdc5072000; bottom 0x7f61ff7fe000; size: 0x009bc5874000 (669033906176) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 #0 0x55a39f1ba822 in qcrypto_cipher_free /tmp/qemu-test/src/crypto/cipher.c:230:23 --- Right alloca redzone: cb Shadow gap: cc ==13802==ABORTING ERROR - too few tests run (expected 16, got 10) make: *** [/tmp/qemu-test/src/tests/Makefile.include:904: check-unit] Error 1 make: *** Waiting for unfinished jobs.... PASS 24 ahci-test /x86_64/ahci/io/pio/lba48/double/zero ==13811==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13811==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffcc03a5000; bottom 0x7f20421fe000; size: 0x00dc7e1a7000 (947008466944) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 25 ahci-test /x86_64/ahci/io/pio/lba48/double/low ==13817==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13817==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc0ac70000; bottom 0x7f29dfdfe000; size: 0x00d22ae72000 (902662922240) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 26 ahci-test /x86_64/ahci/io/pio/lba48/double/high ==13823==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13823==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe1542c000; bottom 0x7fb37b7fe000; size: 0x004a99c2e000 (320407265280) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 27 ahci-test /x86_64/ahci/io/pio/lba48/long/zero ==13829==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13829==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc467cb000; bottom 0x7f9d1ab7c000; size: 0x005f2bc4f000 (408756219904) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 28 ahci-test /x86_64/ahci/io/pio/lba48/long/low ==13835==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==13835==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc09d8f000; bottom 0x7f518f1fe000; size: 0x00aa7ab91000 (732203388928) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 29 ahci-test /x86_64/ahci/io/pio/lba48/long/high ==13842==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 30 ahci-test /x86_64/ahci/io/pio/lba48/short/zero ==13848==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 31 ahci-test /x86_64/ahci/io/pio/lba48/short/low ==13854==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 32 ahci-test /x86_64/ahci/io/pio/lba48/short/high ==13860==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 33 ahci-test /x86_64/ahci/io/dma/lba28/fragmented ==13866==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 34 ahci-test /x86_64/ahci/io/dma/lba28/retry ==13872==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 35 ahci-test /x86_64/ahci/io/dma/lba28/simple/zero ==13878==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 36 ahci-test /x86_64/ahci/io/dma/lba28/simple/low ==13884==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 37 ahci-test /x86_64/ahci/io/dma/lba28/simple/high ==13890==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 38 ahci-test /x86_64/ahci/io/dma/lba28/double/zero ==13896==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 39 ahci-test /x86_64/ahci/io/dma/lba28/double/low ==13902==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 40 ahci-test /x86_64/ahci/io/dma/lba28/double/high ==13908==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 41 ahci-test /x86_64/ahci/io/dma/lba28/long/zero ==13914==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 42 ahci-test /x86_64/ahci/io/dma/lba28/long/low ==13920==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 43 ahci-test /x86_64/ahci/io/dma/lba28/long/high ==13926==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 44 ahci-test /x86_64/ahci/io/dma/lba28/short/zero ==13933==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 45 ahci-test /x86_64/ahci/io/dma/lba28/short/low ==13939==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 46 ahci-test /x86_64/ahci/io/dma/lba28/short/high ==13945==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 47 ahci-test /x86_64/ahci/io/dma/lba48/simple/zero ==13951==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 48 ahci-test /x86_64/ahci/io/dma/lba48/simple/low ==13957==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 49 ahci-test /x86_64/ahci/io/dma/lba48/simple/high ==13963==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 50 ahci-test /x86_64/ahci/io/dma/lba48/double/zero ==13969==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 51 ahci-test /x86_64/ahci/io/dma/lba48/double/low ==13975==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 52 ahci-test /x86_64/ahci/io/dma/lba48/double/high ==13981==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 53 ahci-test /x86_64/ahci/io/dma/lba48/long/zero ==13987==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 54 ahci-test /x86_64/ahci/io/dma/lba48/long/low ==13993==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 55 ahci-test /x86_64/ahci/io/dma/lba48/long/high ==13999==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 56 ahci-test /x86_64/ahci/io/dma/lba48/short/zero ==14005==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 57 ahci-test /x86_64/ahci/io/dma/lba48/short/low ==14011==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 58 ahci-test /x86_64/ahci/io/dma/lba48/short/high ==14017==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 59 ahci-test /x86_64/ahci/io/ncq/simple ==14023==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 60 ahci-test /x86_64/ahci/io/ncq/retry ==14029==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 61 ahci-test /x86_64/ahci/flush/simple ==14035==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 62 ahci-test /x86_64/ahci/flush/retry ==14041==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==14046==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 63 ahci-test /x86_64/ahci/flush/migrate ==14055==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==14060==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 64 ahci-test /x86_64/ahci/migrate/sanity ==14069==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==14074==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 65 ahci-test /x86_64/ahci/migrate/dma/simple ==14083==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==14088==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 66 ahci-test /x86_64/ahci/migrate/dma/halted ==14097==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==14102==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 67 ahci-test /x86_64/ahci/migrate/ncq/simple ==14111==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==14116==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 68 ahci-test /x86_64/ahci/migrate/ncq/halted ==14125==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 69 ahci-test /x86_64/ahci/cdrom/eject ==14130==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 70 ahci-test /x86_64/ahci/cdrom/dma/single ==14136==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 71 ahci-test /x86_64/ahci/cdrom/dma/multi ==14142==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 72 ahci-test /x86_64/ahci/cdrom/pio/single ==14148==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! ==14148==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fffab5ae000; bottom 0x7f24c2dfe000; size: 0x00dae87b0000 (940203245568) False positive error reports may follow For details see https://github.com/google/sanitizers/issues/189 PASS 73 ahci-test /x86_64/ahci/cdrom/pio/multi ==14154==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 74 ahci-test /x86_64/ahci/cdrom/pio/bcl MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/hd-geo-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="hd-geo-test" PASS 1 hd-geo-test /x86_64/hd-geo/ide/none ==14168==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 2 hd-geo-test /x86_64/hd-geo/ide/drive/cd_0 ==14174==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 hd-geo-test /x86_64/hd-geo/ide/drive/mbr/blank ==14180==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 4 hd-geo-test /x86_64/hd-geo/ide/drive/mbr/lba ==14186==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 5 hd-geo-test /x86_64/hd-geo/ide/drive/mbr/chs ==14192==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 6 hd-geo-test /x86_64/hd-geo/ide/device/mbr/blank ==14198==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 7 hd-geo-test /x86_64/hd-geo/ide/device/mbr/lba ==14204==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 8 hd-geo-test /x86_64/hd-geo/ide/device/mbr/chs ==14210==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 9 hd-geo-test /x86_64/hd-geo/ide/device/user/chs ==14215==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 10 hd-geo-test /x86_64/hd-geo/ide/device/user/chst MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/boot-order-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="boot-order-test" PASS 1 boot-order-test /x86_64/boot-order/pc --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14283==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/pc/FACP' Using expected file 'tests/data/acpi/pc/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14289==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/q35/FACP' Using expected file 'tests/data/acpi/q35/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14295==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/pc/FACP.bridge' Looking for expected file 'tests/data/acpi/pc/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14301==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/pc/FACP.ipmikcs' Looking for expected file 'tests/data/acpi/pc/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14307==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/pc/FACP.cphp' Looking for expected file 'tests/data/acpi/pc/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14314==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/pc/FACP.memhp' Looking for expected file 'tests/data/acpi/pc/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14320==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/pc/FACP.numamem' Looking for expected file 'tests/data/acpi/pc/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14326==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/pc/FACP.dimmpxm' Looking for expected file 'tests/data/acpi/pc/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14335==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/q35/FACP.bridge' Looking for expected file 'tests/data/acpi/q35/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14341==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/q35/FACP.mmio64' Looking for expected file 'tests/data/acpi/q35/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14347==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/q35/FACP.ipmibt' Looking for expected file 'tests/data/acpi/q35/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14353==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/q35/FACP.cphp' Looking for expected file 'tests/data/acpi/q35/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14360==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/q35/FACP.memhp' Looking for expected file 'tests/data/acpi/q35/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14366==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/q35/FACP.numamem' Looking for expected file 'tests/data/acpi/q35/FACP' --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14372==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Looking for expected file 'tests/data/acpi/q35/FACP.dimmpxm' Looking for expected file 'tests/data/acpi/q35/FACP' --- PASS 1 i440fx-test /x86_64/i440fx/defaults PASS 2 i440fx-test /x86_64/i440fx/pam PASS 3 i440fx-test /x86_64/i440fx/firmware/bios ==14456==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 4 i440fx-test /x86_64/i440fx/firmware/pflash MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/fw_cfg-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="fw_cfg-test" PASS 1 fw_cfg-test /x86_64/fw_cfg/signature --- MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/drive_del-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="drive_del-test" PASS 1 drive_del-test /x86_64/drive_del/without-dev PASS 2 drive_del-test /x86_64/drive_del/after_failed_device_add ==14544==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 drive_del-test /x86_64/blockdev/drive_del_device_del MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/wdt_ib700-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="wdt_ib700-test" PASS 1 wdt_ib700-test /x86_64/wdt_ib700/pause --- PASS 1 usb-hcd-uhci-test /x86_64/uhci/pci/init PASS 2 usb-hcd-uhci-test /x86_64/uhci/pci/port1 PASS 3 usb-hcd-uhci-test /x86_64/uhci/pci/hotplug ==14739==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 4 usb-hcd-uhci-test /x86_64/uhci/pci/hotplug/usb-storage MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/usb-hcd-xhci-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="usb-hcd-xhci-test" PASS 1 usb-hcd-xhci-test /x86_64/xhci/pci/init PASS 2 usb-hcd-xhci-test /x86_64/xhci/pci/hotplug ==14748==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 usb-hcd-xhci-test /x86_64/xhci/pci/hotplug/usb-uas PASS 4 usb-hcd-xhci-test /x86_64/xhci/pci/hotplug/usb-ccid MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/cpu-plug-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="cpu-plug-test" --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14854==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 1 vmgenid-test /x86_64/vmgenid/vmgenid/set-guid Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14860==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 2 vmgenid-test /x86_64/vmgenid/vmgenid/set-guid-auto Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14866==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 vmgenid-test /x86_64/vmgenid/vmgenid/query-monitor MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/tpm-crb-swtpm-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="tpm-crb-swtpm-test" SKIP 1 tpm-crb-swtpm-test /x86_64/tpm/crb-swtpm/test # SKIP swtpm not in PATH or missing --tpm2 support --- Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14971==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14976==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 3 migration-test /x86_64/migration/fd_proto Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14984==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==14989==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 4 migration-test /x86_64/migration/postcopy/unix PASS 5 migration-test /x86_64/migration/postcopy/recovery Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==15019==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==15024==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 6 migration-test /x86_64/migration/precopy/unix Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==15033==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==15038==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 7 migration-test /x86_64/migration/precopy/tcp Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==15047==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator ==15052==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 8 migration-test /x86_64/migration/xbzrle/unix MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/test-x86-cpuid-compat -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-x86-cpuid-compat" PASS 1 test-x86-cpuid-compat /x86/cpuid/parsing-plus-minus --- PASS 6 numa-test /x86_64/numa/pc/dynamic/cpu MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/qmp-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="qmp-test" PASS 1 qmp-test /x86_64/qmp/protocol ==15381==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 2 qmp-test /x86_64/qmp/oob PASS 3 qmp-test /x86_64/qmp/preconfig PASS 4 qmp-test /x86_64/qmp/missing-any-arg --- PASS 6 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/sdhci-pci/sdhci/sdhci-tests/registers PASS 7 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/tpci200/ipack/ipoctal232/ipoctal232-tests/nop PASS 8 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/tpci200/pci-device/pci-device-tests/nop ==15790==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 9 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-9p-pci/pci-device/pci-device-tests/nop PASS 10 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-9p-pci/virtio/virtio-tests/nop PASS 11 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-9p-pci/virtio-9p/virtio-9p-tests/config --- PASS 20 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-9p-pci/virtio-9p/virtio-9p-tests/fs/flush/ignored PASS 21 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-balloon-pci/pci-device/pci-device-tests/nop PASS 22 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-balloon-pci/virtio/virtio-tests/nop ==15803==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 23 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-blk-pci/virtio-blk/virtio-blk-tests/indirect ==15810==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 24 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-blk-pci/virtio-blk/virtio-blk-tests/config ==15817==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 25 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-blk-pci/virtio-blk/virtio-blk-tests/basic ==15824==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 26 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-blk-pci/virtio-blk/virtio-blk-tests/resize ==15831==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 27 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-blk-pci/virtio-blk-pci-tests/msix ==15838==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 28 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-blk-pci/virtio-blk-pci-tests/idx ==15845==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 29 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-blk-pci/virtio-blk-pci-tests/nxvirtq ==15852==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 30 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-blk-pci/virtio-blk-pci-tests/hotplug PASS 31 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-net-pci/virtio-net/virtio-net-tests/basic PASS 32 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-net-pci/virtio-net/virtio-net-tests/rx_stop_cont --- PASS 40 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-rng-pci/pci-device/pci-device-tests/nop PASS 41 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-rng-pci/virtio/virtio-tests/nop PASS 42 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-rng-pci/virtio-rng-pci-tests/hotplug ==15963==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 43 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-scsi-pci/pci-device/pci-device-tests/nop ==15969==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 44 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-scsi-pci/virtio-scsi/virtio-scsi-tests/hotplug ==15975==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 45 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-scsi-pci/virtio-scsi/virtio-scsi-tests/unaligned-write-same ==15981==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 46 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-scsi-pci/virtio-scsi-pci-tests/iothread-attach-node PASS 47 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-serial-pci/pci-device/pci-device-tests/nop PASS 48 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/virtio-serial-pci/virtio/virtio-tests/nop --- PASS 67 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/i82562/pci-device/pci-device-tests/nop PASS 68 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/i82801/pci-device/pci-device-tests/nop PASS 69 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/ES1370/pci-device/pci-device-tests/nop ==16127==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 70 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/megasas/pci-device/pci-device-tests/nop PASS 71 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/megasas/megasas-tests/dcmd/pd-get-info/fuzz PASS 72 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/ne2k_pci/pci-device/pci-device-tests/nop PASS 73 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/nvme/pci-device/pci-device-tests/nop ==16139==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 74 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/nvme/nvme-tests/oob-cmb-access ==16145==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases! PASS 75 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/pcnet/pci-device/pci-device-tests/nop PASS 76 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/pci-ohci/pci-device/pci-device-tests/nop PASS 77 qos-test /x86_64/pc/i440FX-pcihost/pci-bus-pc/pci-bus/pci-ohci/pci-ohci-tests/ohci_pci-test-hotplug The full log is available at http://patchew.org/logs/20190723154856.17348-1-berrange@redhat.com/testing.asan/?type=message. --- Email generated automatically by Patchew [https://patchew.org/]. Please send your feedback to patchew-devel@redhat.com ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope 2019-07-23 15:48 [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope Daniel P. Berrangé ` (3 preceding siblings ...) 2019-07-23 19:17 ` [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope no-reply @ 2019-07-25 8:38 ` Stefan Hajnoczi 2019-07-25 9:13 ` Peter Maydell 5 siblings, 0 replies; 10+ messages in thread From: Stefan Hajnoczi @ 2019-07-25 8:38 UTC (permalink / raw) To: Daniel P. Berrangé; +Cc: qemu-devel [-- Attachment #1: Type: text/plain, Size: 3331 bytes --] On Tue, Jul 23, 2019 at 04:48:53PM +0100, Daniel P. Berrangé wrote: > Both GCC and CLang support a C extension attribute((cleanup)) which > allows you to define a function that is invoked when a stack variable > exits scope. This typically used to free the memory allocated to it, > though you're not restricted to this. For example it could be used to > unlock a mutex. > > We could use that functionality now, but the syntax is a bit ugly in > plain C. Since version 2.44 of GLib, there have been a few macros to > make it more friendly to use - g_autofree, g_autoptr and > G_DEFINE_AUTOPTR_CLEANUP_FUNC. > > https://developer.gnome.org/glib/stable/glib-Miscellaneous-Macros.html > > https://blogs.gnome.org/desrt/2015/01/30/g_autoptr/ > > The key selling point is that it simplifies the cleanup code paths, > often eliminating the need to goto cleanup labels. This improves > the readability of the code and makes it less likely that you'll > leak memory accidentally. > > Inspired by seeing it added to glib, and used in systemd, Libvirt > finally got around to adopting this in Feb 2019. Overall our > experience with it has been favourable/positive, with the code > simplification being very nice. > > The main caveats with it are > > - Only works with GCC or CLang. We don't care as those are > the only two compilers we declare support for. > > - You must always initialize the variables when declared > to ensure predictable behaviour when they leave scope. > Chances are most methods with goto jumps for cleanup > are doing this already > > - You must not directly return the value that's assigned > to a auto-cleaned variable. You must steal the pointer > in some way. ie > > BAD: > g_autofree char *wibble = g_strdup("wibble") > .... > return wibble; > > GOOD: > g_autofree char *wibble = g_strdup("wibble") > ... > return g_steal_pointer(wibble); > > g_steal_pointer is an inline function which simply copies > the pointer to a new variable, and sets the original variable > to NULL, thus avoiding cleanup. > > I've illustrated the usage by converting a bunch of the crypto code in > QEMU to use auto cleanup. > > Daniel P. Berrangé (3): > glib: bump min required glib library version to 2.48 > crypto: define cleanup functions for use with g_autoptr > crypto: use auto cleanup for many stack variables > > configure | 2 +- > crypto/afsplit.c | 28 ++++---------- > crypto/block-luks.c | 74 +++++++++++-------------------------- > crypto/block.c | 15 +++----- > crypto/hmac-glib.c | 5 --- > crypto/pbkdf.c | 5 +-- > crypto/secret.c | 9 ++--- > crypto/tlscredsanon.c | 16 +++----- > crypto/tlscredspsk.c | 5 +-- > crypto/tlscredsx509.c | 16 +++----- > include/crypto/block.h | 2 + > include/crypto/cipher.h | 2 + > include/crypto/hmac.h | 2 + > include/crypto/ivgen.h | 2 + > include/crypto/tlssession.h | 2 + > include/glib-compat.h | 42 +-------------------- > 16 files changed, 66 insertions(+), 161 deletions(-) > > -- > 2.21.0 > > Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope 2019-07-23 15:48 [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope Daniel P. Berrangé ` (4 preceding siblings ...) 2019-07-25 8:38 ` Stefan Hajnoczi @ 2019-07-25 9:13 ` Peter Maydell 2019-07-25 9:24 ` Daniel P. Berrangé 5 siblings, 1 reply; 10+ messages in thread From: Peter Maydell @ 2019-07-25 9:13 UTC (permalink / raw) To: Daniel P. Berrangé; +Cc: QEMU Developers On Tue, 23 Jul 2019 at 16:49, Daniel P. Berrangé <berrange@redhat.com> wrote: > > Both GCC and CLang support a C extension attribute((cleanup)) which > allows you to define a function that is invoked when a stack variable > exits scope. This typically used to free the memory allocated to it, > though you're not restricted to this. For example it could be used to > unlock a mutex. Does Coverity handle this? Can it be made to wire up this kind of deallocation into checks of use-after-free/memory leaks/etc? thanks - PMM ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope 2019-07-25 9:13 ` Peter Maydell @ 2019-07-25 9:24 ` Daniel P. Berrangé 0 siblings, 0 replies; 10+ messages in thread From: Daniel P. Berrangé @ 2019-07-25 9:24 UTC (permalink / raw) To: Peter Maydell; +Cc: QEMU Developers On Thu, Jul 25, 2019 at 10:13:11AM +0100, Peter Maydell wrote: > On Tue, 23 Jul 2019 at 16:49, Daniel P. Berrangé <berrange@redhat.com> wrote: > > > > Both GCC and CLang support a C extension attribute((cleanup)) which > > allows you to define a function that is invoked when a stack variable > > exits scope. This typically used to free the memory allocated to it, > > though you're not restricted to this. For example it could be used to > > unlock a mutex. > > Does Coverity handle this? Can it be made to wire up this kind > of deallocation into checks of use-after-free/memory leaks/etc? I believe so, in so much as it has not complained about leaks in libvirt where we've removed the free() calls in favour of the attribute(cleanup) annotations. I'm presuming this is because the free() calls do still exist - they're simply automatically added in all paths that exist a code scope. You can still see the free() calls in GDB stack traces for example. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-07-25 9:24 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-07-23 15:48 [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope Daniel P. Berrangé 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 1/3] glib: bump min required glib library version to 2.48 Daniel P. Berrangé 2019-07-23 16:02 ` Thomas Huth 2019-07-23 16:04 ` Daniel P. Berrangé 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 2/3] crypto: define cleanup functions for use with g_autoptr Daniel P. Berrangé 2019-07-23 15:48 ` [Qemu-devel] [PATCH for 4.2 3/3] crypto: use auto cleanup for many stack variables Daniel P. Berrangé 2019-07-23 19:17 ` [Qemu-devel] [PATCH for 4.2 0/3] require newer glib2 to enable autofree'ing of stack variables exiting scope no-reply 2019-07-25 8:38 ` Stefan Hajnoczi 2019-07-25 9:13 ` Peter Maydell 2019-07-25 9:24 ` Daniel P. Berrangé
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).