* [Qemu-devel] [PATCH] crypto: fix initialization of crypto in tests
@ 2016-10-04 13:38 Daniel P. Berrange
2016-10-04 15:21 ` Dr. David Alan Gilbert
2016-10-04 20:24 ` Eric Blake
0 siblings, 2 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2016-10-04 13:38 UTC (permalink / raw)
To: qemu-devel; +Cc: Dr . David Alan Gilbert, Daniel P. Berrange
The test-io-channel-tls test was missing a call to qcrypto_init
and test-crypto-hash was initializing it multiple times,
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
tests/test-crypto-hash.c | 12 ++----------
tests/test-io-channel-tls.c | 3 +++
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/tests/test-crypto-hash.c b/tests/test-crypto-hash.c
index 42fc77a..214a9f7 100644
--- a/tests/test-crypto-hash.c
+++ b/tests/test-crypto-hash.c
@@ -89,8 +89,6 @@ static void test_hash_alloc(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
uint8_t *result = NULL;
size_t resultlen = 0;
@@ -123,8 +121,6 @@ static void test_hash_prealloc(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
uint8_t *result;
size_t resultlen;
@@ -161,8 +157,6 @@ static void test_hash_iov(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
struct iovec iov[3] = {
{ .iov_base = (char *)INPUT_TEXT1, .iov_len = strlen(INPUT_TEXT1) },
@@ -199,8 +193,6 @@ static void test_hash_digest(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
int ret;
char *digest;
@@ -230,8 +222,6 @@ static void test_hash_base64(void)
{
size_t i;
- g_assert(qcrypto_init(NULL) == 0);
-
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
int ret;
char *digest;
@@ -253,6 +243,8 @@ static void test_hash_base64(void)
int main(int argc, char **argv)
{
+ g_assert(qcrypto_init(NULL) == 0);
+
g_test_init(&argc, &argv, NULL);
g_test_add_func("/crypto/hash/iov", test_hash_iov);
g_test_add_func("/crypto/hash/alloc", test_hash_alloc);
diff --git a/tests/test-io-channel-tls.c b/tests/test-io-channel-tls.c
index 3c361a7..bd3ae2b 100644
--- a/tests/test-io-channel-tls.c
+++ b/tests/test-io-channel-tls.c
@@ -27,6 +27,7 @@
#include "io/channel-tls.h"
#include "io/channel-socket.h"
#include "io-channel-helpers.h"
+#include "crypto/init.h"
#include "crypto/tlscredsx509.h"
#include "qemu/acl.h"
#include "qom/object_interfaces.h"
@@ -265,6 +266,8 @@ int main(int argc, char **argv)
{
int ret;
+ g_assert(qcrypto_init(NULL) == 0);
+
module_call_init(MODULE_INIT_QOM);
g_test_init(&argc, &argv, NULL);
setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] crypto: fix initialization of crypto in tests
2016-10-04 13:38 [Qemu-devel] [PATCH] crypto: fix initialization of crypto in tests Daniel P. Berrange
@ 2016-10-04 15:21 ` Dr. David Alan Gilbert
2016-10-04 16:39 ` Daniel P. Berrange
2016-10-04 20:24 ` Eric Blake
1 sibling, 1 reply; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2016-10-04 15:21 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: qemu-devel
* Daniel P. Berrange (berrange@redhat.com) wrote:
> The test-io-channel-tls test was missing a call to qcrypto_init
> and test-crypto-hash was initializing it multiple times,
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
I still seem to have a failure on rhel6 with this; but not everytime,
maybe it's passing 10-20%ish ?
Dave
GTESTER tests/test-io-channel-tls
test-io-channel-tls: ath.c:193: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed.
GTester: last random seed: R02S804c19865af34376817b500c2a170214
#12 0x00007ffff66cd186 in ?? () from /usr/lib64/libgnutls.so.26
#13 0x00007ffff66ca546 in _gnutls_recv_int () from /usr/lib64/libgnutls.so.26
#14 0x00007ffff7f75f8d in qcrypto_tls_session_read (session=<value optimized out>, buf=<value optimized out>,
len=<value optimized out>) at /root/hmp/qemu/crypto/tlssession.c:420
#15 0x00007ffff7f6d5e7 in qio_channel_tls_readv (ioc=<value optimized out>, iov=<value optimized out>, niov=250,
fds=<value optimized out>, nfds=<value optimized out>, errp=0x7ffff837a850)
at /root/hmp/qemu/io/channel-tls.c:249
#16 0x00007ffff7f686ca in test_io_thread_reader (opaque=0x7ffff837a800)
at /root/hmp/qemu/tests/io-channel-helpers.c:129
#17 0x00007ffff7459374 in ?? () from /lib64/libglib-2.0.so.0
#18 0x00007ffff5afbaa1 in start_thread () from /lib64/libpthread.so.0
#19 0x00007ffff5848aad in clone () from /lib64/libc.so.6
> ---
> tests/test-crypto-hash.c | 12 ++----------
> tests/test-io-channel-tls.c | 3 +++
> 2 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/tests/test-crypto-hash.c b/tests/test-crypto-hash.c
> index 42fc77a..214a9f7 100644
> --- a/tests/test-crypto-hash.c
> +++ b/tests/test-crypto-hash.c
> @@ -89,8 +89,6 @@ static void test_hash_alloc(void)
> {
> size_t i;
>
> - g_assert(qcrypto_init(NULL) == 0);
> -
> for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> uint8_t *result = NULL;
> size_t resultlen = 0;
> @@ -123,8 +121,6 @@ static void test_hash_prealloc(void)
> {
> size_t i;
>
> - g_assert(qcrypto_init(NULL) == 0);
> -
> for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> uint8_t *result;
> size_t resultlen;
> @@ -161,8 +157,6 @@ static void test_hash_iov(void)
> {
> size_t i;
>
> - g_assert(qcrypto_init(NULL) == 0);
> -
> for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> struct iovec iov[3] = {
> { .iov_base = (char *)INPUT_TEXT1, .iov_len = strlen(INPUT_TEXT1) },
> @@ -199,8 +193,6 @@ static void test_hash_digest(void)
> {
> size_t i;
>
> - g_assert(qcrypto_init(NULL) == 0);
> -
> for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> int ret;
> char *digest;
> @@ -230,8 +222,6 @@ static void test_hash_base64(void)
> {
> size_t i;
>
> - g_assert(qcrypto_init(NULL) == 0);
> -
> for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> int ret;
> char *digest;
> @@ -253,6 +243,8 @@ static void test_hash_base64(void)
>
> int main(int argc, char **argv)
> {
> + g_assert(qcrypto_init(NULL) == 0);
> +
> g_test_init(&argc, &argv, NULL);
> g_test_add_func("/crypto/hash/iov", test_hash_iov);
> g_test_add_func("/crypto/hash/alloc", test_hash_alloc);
> diff --git a/tests/test-io-channel-tls.c b/tests/test-io-channel-tls.c
> index 3c361a7..bd3ae2b 100644
> --- a/tests/test-io-channel-tls.c
> +++ b/tests/test-io-channel-tls.c
> @@ -27,6 +27,7 @@
> #include "io/channel-tls.h"
> #include "io/channel-socket.h"
> #include "io-channel-helpers.h"
> +#include "crypto/init.h"
> #include "crypto/tlscredsx509.h"
> #include "qemu/acl.h"
> #include "qom/object_interfaces.h"
> @@ -265,6 +266,8 @@ int main(int argc, char **argv)
> {
> int ret;
>
> + g_assert(qcrypto_init(NULL) == 0);
> +
> module_call_init(MODULE_INIT_QOM);
> g_test_init(&argc, &argv, NULL);
> setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
> --
> 2.7.4
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] crypto: fix initialization of crypto in tests
2016-10-04 15:21 ` Dr. David Alan Gilbert
@ 2016-10-04 16:39 ` Daniel P. Berrange
0 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2016-10-04 16:39 UTC (permalink / raw)
To: Dr. David Alan Gilbert; +Cc: qemu-devel
On Tue, Oct 04, 2016 at 04:21:03PM +0100, Dr. David Alan Gilbert wrote:
> * Daniel P. Berrange (berrange@redhat.com) wrote:
> > The test-io-channel-tls test was missing a call to qcrypto_init
> > and test-crypto-hash was initializing it multiple times,
> >
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
>
> I still seem to have a failure on rhel6 with this; but not everytime,
> maybe it's passing 10-20%ish ?
>
> Dave
>
> GTESTER tests/test-io-channel-tls
> test-io-channel-tls: ath.c:193: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed.
> GTester: last random seed: R02S804c19865af34376817b500c2a170214
>
> #12 0x00007ffff66cd186 in ?? () from /usr/lib64/libgnutls.so.26
> #13 0x00007ffff66ca546 in _gnutls_recv_int () from /usr/lib64/libgnutls.so.26
> #14 0x00007ffff7f75f8d in qcrypto_tls_session_read (session=<value optimized out>, buf=<value optimized out>,
> len=<value optimized out>) at /root/hmp/qemu/crypto/tlssession.c:420
> #15 0x00007ffff7f6d5e7 in qio_channel_tls_readv (ioc=<value optimized out>, iov=<value optimized out>, niov=250,
> fds=<value optimized out>, nfds=<value optimized out>, errp=0x7ffff837a850)
> at /root/hmp/qemu/io/channel-tls.c:249
> #16 0x00007ffff7f686ca in test_io_thread_reader (opaque=0x7ffff837a800)
> at /root/hmp/qemu/tests/io-channel-helpers.c:129
> #17 0x00007ffff7459374 in ?? () from /lib64/libglib-2.0.so.0
> #18 0x00007ffff5afbaa1 in start_thread () from /lib64/libpthread.so.0
> #19 0x00007ffff5848aad in clone () from /lib64/libc.so.6
Ok, I've found a second bug - we need to reverse the order of some
initialization calls in qcrypto_init() too. This patch here is still
needed, but i'll send a additional one too.
>
> > ---
> > tests/test-crypto-hash.c | 12 ++----------
> > tests/test-io-channel-tls.c | 3 +++
> > 2 files changed, 5 insertions(+), 10 deletions(-)
> >
> > diff --git a/tests/test-crypto-hash.c b/tests/test-crypto-hash.c
> > index 42fc77a..214a9f7 100644
> > --- a/tests/test-crypto-hash.c
> > +++ b/tests/test-crypto-hash.c
> > @@ -89,8 +89,6 @@ static void test_hash_alloc(void)
> > {
> > size_t i;
> >
> > - g_assert(qcrypto_init(NULL) == 0);
> > -
> > for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> > uint8_t *result = NULL;
> > size_t resultlen = 0;
> > @@ -123,8 +121,6 @@ static void test_hash_prealloc(void)
> > {
> > size_t i;
> >
> > - g_assert(qcrypto_init(NULL) == 0);
> > -
> > for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> > uint8_t *result;
> > size_t resultlen;
> > @@ -161,8 +157,6 @@ static void test_hash_iov(void)
> > {
> > size_t i;
> >
> > - g_assert(qcrypto_init(NULL) == 0);
> > -
> > for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> > struct iovec iov[3] = {
> > { .iov_base = (char *)INPUT_TEXT1, .iov_len = strlen(INPUT_TEXT1) },
> > @@ -199,8 +193,6 @@ static void test_hash_digest(void)
> > {
> > size_t i;
> >
> > - g_assert(qcrypto_init(NULL) == 0);
> > -
> > for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> > int ret;
> > char *digest;
> > @@ -230,8 +222,6 @@ static void test_hash_base64(void)
> > {
> > size_t i;
> >
> > - g_assert(qcrypto_init(NULL) == 0);
> > -
> > for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> > int ret;
> > char *digest;
> > @@ -253,6 +243,8 @@ static void test_hash_base64(void)
> >
> > int main(int argc, char **argv)
> > {
> > + g_assert(qcrypto_init(NULL) == 0);
> > +
> > g_test_init(&argc, &argv, NULL);
> > g_test_add_func("/crypto/hash/iov", test_hash_iov);
> > g_test_add_func("/crypto/hash/alloc", test_hash_alloc);
> > diff --git a/tests/test-io-channel-tls.c b/tests/test-io-channel-tls.c
> > index 3c361a7..bd3ae2b 100644
> > --- a/tests/test-io-channel-tls.c
> > +++ b/tests/test-io-channel-tls.c
> > @@ -27,6 +27,7 @@
> > #include "io/channel-tls.h"
> > #include "io/channel-socket.h"
> > #include "io-channel-helpers.h"
> > +#include "crypto/init.h"
> > #include "crypto/tlscredsx509.h"
> > #include "qemu/acl.h"
> > #include "qom/object_interfaces.h"
> > @@ -265,6 +266,8 @@ int main(int argc, char **argv)
> > {
> > int ret;
> >
> > + g_assert(qcrypto_init(NULL) == 0);
> > +
> > module_call_init(MODULE_INIT_QOM);
> > g_test_init(&argc, &argv, NULL);
> > setenv("GNUTLS_FORCE_FIPS_MODE", "2", 1);
> > --
> > 2.7.4
> >
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] crypto: fix initialization of crypto in tests
2016-10-04 13:38 [Qemu-devel] [PATCH] crypto: fix initialization of crypto in tests Daniel P. Berrange
2016-10-04 15:21 ` Dr. David Alan Gilbert
@ 2016-10-04 20:24 ` Eric Blake
1 sibling, 0 replies; 4+ messages in thread
From: Eric Blake @ 2016-10-04 20:24 UTC (permalink / raw)
To: Daniel P. Berrange, qemu-devel; +Cc: Dr . David Alan Gilbert
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
On 10/04/2016 08:38 AM, Daniel P. Berrange wrote:
> The test-io-channel-tls test was missing a call to qcrypto_init
> and test-crypto-hash was initializing it multiple times,
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> tests/test-crypto-hash.c | 12 ++----------
> tests/test-io-channel-tls.c | 3 +++
> 2 files changed, 5 insertions(+), 10 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-04 20:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-04 13:38 [Qemu-devel] [PATCH] crypto: fix initialization of crypto in tests Daniel P. Berrange
2016-10-04 15:21 ` Dr. David Alan Gilbert
2016-10-04 16:39 ` Daniel P. Berrange
2016-10-04 20:24 ` Eric Blake
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.