[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 30/42] test-coroutine: Fix coroutine pool corruption
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 30/42] test-coroutine: Fix coroutine pool corruption |
Date: |
Mon, 5 Sep 2016 20:13:42 +0200 |
The test case overwrites the Coroutine object with 0xff as a way to
assert that the coroutine isn't used any more. However, this means that
the coroutine pool now contains a corrupted object and later test cases
may get this corrupted object and crash.
This patch saves the real content of the object and restores it after
completing the test. The only use of the coroutine pool between those
two points is the deletion of co2. As this only means an insertion at
the head of an SLIST (release_pool or alloc_pool), it doesn't access the
invalid list pointers that co1 has during this period.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
tests/test-coroutine.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c
index ee5e06d..6431dd6 100644
--- a/tests/test-coroutine.c
+++ b/tests/test-coroutine.c
@@ -139,13 +139,20 @@ static void test_co_queue(void)
{
Coroutine *c1;
Coroutine *c2;
+ Coroutine tmp;
c2 = qemu_coroutine_create(c2_fn, NULL);
c1 = qemu_coroutine_create(c1_fn, c2);
qemu_coroutine_enter(c1);
+
+ /* c1 shouldn't be used any more now; make sure we segfault if it is */
+ tmp = *c1;
memset(c1, 0xff, sizeof(Coroutine));
qemu_coroutine_enter(c2);
+
+ /* Must restore the coroutine now to avoid corrupted pool */
+ *c1 = tmp;
}
/*
--
1.8.3.1
- [Qemu-block] [PULL 22/42] block: remove BlockDriver.bdrv_write_compressed, (continued)
- [Qemu-block] [PULL 22/42] block: remove BlockDriver.bdrv_write_compressed, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 28/42] qemu-iotests: test backup compression in 055, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 23/42] block/io: turn on dirty_bitmaps for the compressed writes, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 24/42] block: simplify drive-backup, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 25/42] block: simplify blockdev-backup, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 29/42] qemu-iotests: add vmdk for test backup compression in 055, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 26/42] drive-backup: added support for data compression, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 27/42] blockdev-backup: added support for data compression, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 30/42] test-coroutine: Fix coroutine pool corruption,
Kevin Wolf <=
- [Qemu-block] [PULL 32/42] coroutine: Let CoMutex remember who holds it, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 31/42] qcow2: fix iovec size at qcow2_co_pwritev_compressed, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 34/42] block jobs: Improve error message for missing job ID, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 35/42] qemu-iotests: Log QMP traffic in debug mode, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 36/42] block: Allow node name for 'qemu-io' HMP command, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 38/42] coroutine: add a macro for the coroutine stack size, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 37/42] oslib-posix: add helpers for stack alloc and free, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 33/42] coroutine: Assert that no locks are held on termination, Kevin Wolf, 2016/09/05
- [Qemu-block] [PULL 40/42] coroutine-sigaltstack: use helper for allocating stack memory, Kevin Wolf, 2016/09/05