net/colo-compare.c: Fix a crash in COLO Primary.
PATCH v2 1/1 net/colo-compare.c: Fix a crash in COLO Primary.
From: Lukas Straub <[email protected]>
Because event_unhandled_count may be accessed concurrently, it needs to be protected by taking the lock. However the assert is outside the lock, probably causing it to read garbage and aborting Qemu erroneously.
The Bug only happens when running Qemu in COLO mode.
This Patch fixes the following bug: https://bugs.launchpad.net/qemu/+bug/1824622
--- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/colo-compare.c +1 -2
@@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque)break ; } -assert (event_unhandled_count >0 ); -qemu_mutex_lock (&event_mtx); +assert (event_unhandled_count >0 ); event_unhandled_count--;qemu_cond_broadcast (&event_complete_cond);qemu_mutex_unlock (&event_mtx);
--
2.20.1
Quoted 30 lines · Lukas Straub
From: Lukas Straub <[email protected]>
Becauseevent_unhandled_countmay be accessed concurrently, it needs to be protected by taking the lock. However the assert is outside the lock, probably causing it to read garbage and aborting Qemu erroneously.The Bug only happens when running Qemu in COLO mode.
This Patch fixes the following bug: https://bugs.launchpad.net/qemu/+bug/1824622
Signed-off-by Lukas Straub <[email protected]>--- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)net/colo-compare.c +1
-3@@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque)break ; } -assert (event_unhandled_count >0 ); -qemu_mutex_lock (&event_mtx); +assert (event_unhandled_count >0 ); event_unhandled_count--;qemu_cond_broadcast (&event_complete_cond);qemu_mutex_unlock (&event_mtx); --
Quoted 3 lines
2.20.1
Quoted 13 lines
-----Original Message-----
From: Lukas Straub [mailto:[email protected]]
Sent: Sunday, April 21, 2019 1:14 AM
To: [email protected]
Cc: Zhang, Chen <[email protected]>
Subject: [PATCH v2]net/colo-compare.c: Fix a crash in COLO Primary.From: Lukas Straub <[email protected]> Because
event_unhandled_countmay be accessed concurrently, it needs to be protected by taking the lock. However the assert is outside the lock, probably causing it to read garbage and aborting Qemu erroneously.
Quoted 6 lines
The Bug only happens when running Qemu in COLO mode.
This Patch fixes the following bug:
https://bugs.launchpad.net/qemu/+bug/1824622Signed-off-by Lukas Straub <[email protected]>
Looks good for me.
Thanks
Zhang Chen
Quoted 21 lines
--- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)net/colo-compare.c index renamed from net/colo-compare.c +0
-0
bf10526f05..fcb491121b100644net/colo-compare.c +1
-3@@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque)break ; } -assert (event_unhandled_count >0 ); -qemu_mutex_lock (&event_mtx); +assert (event_unhandled_count >0 ); event_unhandled_count--;qemu_cond_broadcast (&event_complete_cond);qemu_mutex_unlock (&event_mtx); --2.20.1
Quoted 21 lines · On Sat, 20 Apr 2019 19:14:25 +0200 Lukas Straub <[email protected]> wrote:
From: Lukas Straub <[email protected]>
Becauseevent_unhandled_countmay be accessed concurrently, it needs to be protected by taking the lock. However the assert is outside the lock, probably causing it to read garbage and aborting Qemu erroneously.The Bug only happens when running Qemu in COLO mode.
This Patch fixes the following bug:
https://bugs.launchpad.net/qemu/+bug/1824622Signed-off-by Lukas Straub <[email protected]>--- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)net/colo-compare.c +0
-0
net/colo-compare.c static void colo_compare_handle_event(void · line 820
Quoted 10 lines
net/colo-compare.c +1
-2@@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque) break; } -assert (event_unhandled_count >0 ); -qemu_mutex_lock (&event_mtx); +assert (event_unhandled_count >0 ); event_unhandled_count--;qemu_cond_broadcast (&event_complete_cond);qemu_mutex_unlock (&event_mtx);
Ping.
Regards,
Lukas Straub
Cc'ing Paolo & Stefan
Quoted 33 lines · Lukas Straub
From: Lukas Straub <[email protected]>
Becauseevent_unhandled_countmay be accessed concurrently, it needs to be protected by taking the lock. However the assert is outside the lock, probably causing it to read garbage and aborting Qemu erroneously.The Bug only happens when running Qemu in COLO mode.
This Patch fixes the following bug: https://bugs.launchpad.net/qemu/+bug/1824622
Signed-off-by Lukas Straub <[email protected]>--- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)net/colo-compare.c +1
-3@@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque)break ; } -assert (event_unhandled_count >0 ); -qemu_mutex_lock (&event_mtx); +assert (event_unhandled_count >0 ); event_unhandled_count--;qemu_cond_broadcast (&event_complete_cond);qemu_mutex_unlock (&event_mtx); --2.20.1
Jason Wang
AppliedQuoted 36 lines · Lukas Straub
Quoted 21 lines · On Sat, 20 Apr 2019 19:14:25 +0200 Lukas Straub <[email protected]> wrote:
From: Lukas Straub <[email protected]>
Becauseevent_unhandled_countmay be accessed concurrently, it needs to be protected by taking the lock. However the assert is outside the lock, probably causing it to read garbage and aborting Qemu erroneously.The Bug only happens when running Qemu in COLO mode.
This Patch fixes the following bug:
https://bugs.launchpad.net/qemu/+bug/1824622Signed-off-by Lukas Straub <[email protected]>--- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)net/colo-compare.c +0
-0net/colo-compare.c static void colo_compare_handle_event(void · line 820
Quoted 10 lines
net/colo-compare.c +1
-2@@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque) break; } -assert (event_unhandled_count >0 ); -qemu_mutex_lock (&event_mtx); +assert (event_unhandled_count >0 ); event_unhandled_count--;qemu_cond_broadcast (&event_complete_cond);qemu_mutex_unlock (&event_mtx);Ping.
Quoted 2 lines
Regards,
Lukas Straub
Applied.
Thanks