[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 24/25] util/main-loop: Fix incorrect assertion
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 24/25] util/main-loop: Fix incorrect assertion |
Date: |
Fri, 21 Jun 2019 13:30:19 +0200 |
From: Lidong Chen <address@hidden>
The check for poll_fds in g_assert() was incorrect. The correct assertion
should check "n_poll_fds + w->num <= ARRAY_SIZE(poll_fds)" because the
subsequent for-loop is doing access to poll_fds[n_poll_fds + i] where i
is in [0, w->num). This could happen with a very high number of file
descriptors and/or wait objects.
Signed-off-by: Lidong Chen <address@hidden>
Suggested-by: Peter Maydell <address@hidden>
Suggested-by: Liam Merwick <address@hidden>
Reviewed-by: Liran Alon <address@hidden>
Reviewed-by: Darren Kenny <address@hidden>
Reviewed-by: Li Qiang <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
util/main-loop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/main-loop.c b/util/main-loop.c
index e1e349c..a9f4e8d 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -422,7 +422,7 @@ static int os_host_main_loop_wait(int64_t timeout)
g_main_context_prepare(context, &max_priority);
n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout,
poll_fds, ARRAY_SIZE(poll_fds));
- g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds));
+ g_assert(n_poll_fds + w->num <= ARRAY_SIZE(poll_fds));
for (i = 0; i < w->num; i++) {
poll_fds[n_poll_fds + i].fd = (DWORD_PTR)w->events[i];
--
1.8.3.1
- [Qemu-devel] [PULL 09/25] i386/kvm: hv-tlbflush/ipi require hv-vpindex, (continued)
- [Qemu-devel] [PULL 09/25] i386/kvm: hv-tlbflush/ipi require hv-vpindex, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 07/25] i386/kvm: implement 'hv-passthrough' mode, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 08/25] i386/kvm: hv-stimer requires hv-time and hv-synic, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 11/25] i386/kvm: add support for Direct Mode for Hyper-V synthetic timers, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 12/25] target/i386: define a new MSR based feature word - FEAT_CORE_CAPABILITY, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 13/25] target/i386: kvm: Delete VMX migration blocker on vCPU init failure, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 17/25] target/i386: kvm: Block migration for vCPUs exposed with nested virtualization, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 18/25] linux-headers: sync with latest KVM headers from Linux 5.2, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 21/25] target/i386: kvm: Add support for KVM_CAP_EXCEPTION_PAYLOAD, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 23/25] sd: Fix out-of-bounds assertions, Paolo Bonzini, 2019/06/21
- [Qemu-devel] [PULL 24/25] util/main-loop: Fix incorrect assertion,
Paolo Bonzini <=
- [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Paolo Bonzini, 2019/06/21
- Re: [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Liran Alon, 2019/06/21
- Re: [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Paolo Bonzini, 2019/06/21
- Re: [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Liran Alon, 2019/06/21
- Re: [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Paolo Bonzini, 2019/06/21
- Re: [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Liran Alon, 2019/06/21
- Re: [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Paolo Bonzini, 2019/06/21
- Re: [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Liran Alon, 2019/06/21
- Re: [Qemu-devel] [PULL 20/25] target/i386: kvm: Add support for save and restore nested state, Liran Alon, 2019/06/21
[Qemu-devel] [PULL 25/25] hw: Nuke hw_compat_4_0_1 and pc_compat_4_0_1, Paolo Bonzini, 2019/06/21