From 99b5beba2f6c3f2e206e6200a05519a0ec2dc8db Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 9 May 2012 14:23:27 -0300 Subject: [PATCH 1/3] coroutine: Fix setup of sigaltstack coroutines Use pthread_kill instead of process-wide kill to invoke the signal handler used for stack switching. This may fix spurious lock-ups with this backend, easily triggerable by extending the time window between kill and sigsuspend. Signed-off-by: Jan Kiszka Reviewed-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- coroutine-sigaltstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coroutine-sigaltstack.c b/coroutine-sigaltstack.c index 7ff2d3379e..b2e316cea2 100644 --- a/coroutine-sigaltstack.c +++ b/coroutine-sigaltstack.c @@ -226,7 +226,7 @@ static Coroutine *coroutine_new(void) * called. */ coTS->tr_called = 0; - kill(getpid(), SIGUSR2); + pthread_kill(pthread_self(), SIGUSR2); sigfillset(&sigs); sigdelset(&sigs, SIGUSR2); while (!coTS->tr_called) { From c44bfe4637424a8f1b411b72a465951f104c29ea Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 11 May 2012 15:33:03 +0200 Subject: [PATCH 2/3] qcow2: Don't ignore failure to clear autoclear flags Signed-off-by: Kevin Wolf --- block/qcow2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/qcow2.c b/block/qcow2.c index 3bae2d837e..655799c6a0 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -300,7 +300,10 @@ static int qcow2_open(BlockDriverState *bs, int flags) if (!bs->read_only && s->autoclear_features != 0) { s->autoclear_features = 0; - qcow2_update_header(bs); + ret = qcow2_update_header(bs); + if (ret < 0) { + goto fail; + } } /* Check support for various header values */ From fa170c148b12f40e803af5b442d33f16add345a4 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Fri, 11 May 2012 10:57:54 -0600 Subject: [PATCH 3/3] qemu-img: Fix segmentation fault The following command generates a segmentation fault. qemu-img convert -O vpc -o ? test test2 This is because the 'goto out;' statement calls qemu_progress_end before qemu_progress_init is called resulting in a NULL pointer invocation. Signed-off-by: Charles Arnold Signed-off-by: Kevin Wolf --- qemu-img.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index 5434ddc5ee..c8a70ffc93 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -712,6 +712,9 @@ static int img_convert(int argc, char **argv) out_filename = argv[argc - 1]; + /* Initialize before goto out */ + qemu_progress_init(progress, 2.0); + if (options && !strcmp(options, "?")) { ret = print_block_option_help(out_filename, out_fmt); goto out; @@ -724,7 +727,6 @@ static int img_convert(int argc, char **argv) goto out; } - qemu_progress_init(progress, 2.0); qemu_progress_print(0, 100); bs = g_malloc0(bs_n * sizeof(BlockDriverState *));