* [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload
@ 2019-08-07 8:40 Marc-André Lureau
2019-08-07 11:21 ` Liam Merwick
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Marc-André Lureau @ 2019-08-07 8:40 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, kraxel
If interface_count is NO_INTERFACE_INFO, let's not access the arrays
out-of-bounds.
==994==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000243930 at pc 0x5642068086a8 bp 0x7f0b6f9ffa50 sp 0x7f0b6f9ffa40
READ of size 1 at 0x625000243930 thread T0
#0 0x5642068086a7 in usbredir_check_bulk_receiving /home/elmarco/src/qemu/hw/usb/redirect.c:1503
#1 0x56420681301c in usbredir_post_load /home/elmarco/src/qemu/hw/usb/redirect.c:2154
#2 0x5642068a56c2 in vmstate_load_state /home/elmarco/src/qemu/migration/vmstate.c:168
#3 0x56420688e2ac in vmstate_load /home/elmarco/src/qemu/migration/savevm.c:829
#4 0x5642068980cb in qemu_loadvm_section_start_full /home/elmarco/src/qemu/migration/savevm.c:2211
#5 0x564206899645 in qemu_loadvm_state_main /home/elmarco/src/qemu/migration/savevm.c:2395
#6 0x5642068998cf in qemu_loadvm_state /home/elmarco/src/qemu/migration/savevm.c:2467
#7 0x56420685f3e9 in process_incoming_migration_co /home/elmarco/src/qemu/migration/migration.c:449
#8 0x564207106c47 in coroutine_trampoline /home/elmarco/src/qemu/util/coroutine-ucontext.c:115
#9 0x7f0c0604e37f (/lib64/libc.so.6+0x4d37f)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/usb/redirect.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 998fc6e4b0..9764a57987 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1495,6 +1495,11 @@ static void usbredir_check_bulk_receiving(USBRedirDevice *dev)
for (i = EP2I(USB_DIR_IN); i < MAX_ENDPOINTS; i++) {
dev->endpoint[i].bulk_receiving_enabled = 0;
}
+
+ if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
+ return;
+ }
+
for (i = 0; i < dev->interface_info.interface_count; i++) {
quirks = usb_get_quirks(dev->device_info.vendor_id,
dev->device_info.product_id,
--
2.23.0.rc1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload
2019-08-07 8:40 [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload Marc-André Lureau
@ 2019-08-07 11:21 ` Liam Merwick
2019-08-07 11:30 ` Li Qiang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Liam Merwick @ 2019-08-07 11:21 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: kraxel
On 07/08/2019 09:40, Marc-André Lureau wrote:
> If interface_count is NO_INTERFACE_INFO, let's not access the arrays
> out-of-bounds.
>
> ==994==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000243930 at pc 0x5642068086a8 bp 0x7f0b6f9ffa50 sp 0x7f0b6f9ffa40
> READ of size 1 at 0x625000243930 thread T0
> #0 0x5642068086a7 in usbredir_check_bulk_receiving /home/elmarco/src/qemu/hw/usb/redirect.c:1503
> #1 0x56420681301c in usbredir_post_load /home/elmarco/src/qemu/hw/usb/redirect.c:2154
> #2 0x5642068a56c2 in vmstate_load_state /home/elmarco/src/qemu/migration/vmstate.c:168
> #3 0x56420688e2ac in vmstate_load /home/elmarco/src/qemu/migration/savevm.c:829
> #4 0x5642068980cb in qemu_loadvm_section_start_full /home/elmarco/src/qemu/migration/savevm.c:2211
> #5 0x564206899645 in qemu_loadvm_state_main /home/elmarco/src/qemu/migration/savevm.c:2395
> #6 0x5642068998cf in qemu_loadvm_state /home/elmarco/src/qemu/migration/savevm.c:2467
> #7 0x56420685f3e9 in process_incoming_migration_co /home/elmarco/src/qemu/migration/migration.c:449
> #8 0x564207106c47 in coroutine_trampoline /home/elmarco/src/qemu/util/coroutine-ucontext.c:115
> #9 0x7f0c0604e37f (/lib64/libc.so.6+0x4d37f)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
> ---
> hw/usb/redirect.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index 998fc6e4b0..9764a57987 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -1495,6 +1495,11 @@ static void usbredir_check_bulk_receiving(USBRedirDevice *dev)
> for (i = EP2I(USB_DIR_IN); i < MAX_ENDPOINTS; i++) {
> dev->endpoint[i].bulk_receiving_enabled = 0;
> }
> +
> + if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
> + return;
> + }
> +
> for (i = 0; i < dev->interface_info.interface_count; i++) {
> quirks = usb_get_quirks(dev->device_info.vendor_id,
> dev->device_info.product_id,
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload
2019-08-07 8:40 [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload Marc-André Lureau
2019-08-07 11:21 ` Liam Merwick
@ 2019-08-07 11:30 ` Li Qiang
2019-08-07 13:34 ` Philippe Mathieu-Daudé
2019-08-14 12:06 ` Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Li Qiang @ 2019-08-07 11:30 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: kraxel, qemu-devel
Marc-André Lureau <marcandre.lureau@redhat.com>于2019年8月7日 周三下午4:41写道:
> If interface_count is NO_INTERFACE_INFO, let's not access the arrays
> out-of-bounds.
>
> ==994==ERROR: AddressSanitizer: heap-buffer-overflow on address
> 0x625000243930 at pc 0x5642068086a8 bp 0x7f0b6f9ffa50 sp 0x7f0b6f9ffa40
> READ of size 1 at 0x625000243930 thread T0
> #0 0x5642068086a7 in usbredir_check_bulk_receiving
> /home/elmarco/src/qemu/hw/usb/redirect.c:1503
> #1 0x56420681301c in usbredir_post_load
> /home/elmarco/src/qemu/hw/usb/redirect.c:2154
> #2 0x5642068a56c2 in vmstate_load_state
> /home/elmarco/src/qemu/migration/vmstate.c:168
> #3 0x56420688e2ac in vmstate_load
> /home/elmarco/src/qemu/migration/savevm.c:829
> #4 0x5642068980cb in qemu_loadvm_section_start_full
> /home/elmarco/src/qemu/migration/savevm.c:2211
> #5 0x564206899645 in qemu_loadvm_state_main
> /home/elmarco/src/qemu/migration/savevm.c:2395
> #6 0x5642068998cf in qemu_loadvm_state
> /home/elmarco/src/qemu/migration/savevm.c:2467
> #7 0x56420685f3e9 in process_incoming_migration_co
> /home/elmarco/src/qemu/migration/migration.c:449
> #8 0x564207106c47 in coroutine_trampoline
> /home/elmarco/src/qemu/util/coroutine-ucontext.c:115
> #9 0x7f0c0604e37f (/lib64/libc.so.6+0x4d37f)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
> ---
> hw/usb/redirect.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index 998fc6e4b0..9764a57987 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -1495,6 +1495,11 @@ static void
> usbredir_check_bulk_receiving(USBRedirDevice *dev)
> for (i = EP2I(USB_DIR_IN); i < MAX_ENDPOINTS; i++) {
> dev->endpoint[i].bulk_receiving_enabled = 0;
> }
> +
> + if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
> + return;
> + }
> +
> for (i = 0; i < dev->interface_info.interface_count; i++) {
> quirks = usb_get_quirks(dev->device_info.vendor_id,
> dev->device_info.product_id,
> --
> 2.23.0.rc1
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload
2019-08-07 8:40 [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload Marc-André Lureau
2019-08-07 11:21 ` Liam Merwick
2019-08-07 11:30 ` Li Qiang
@ 2019-08-07 13:34 ` Philippe Mathieu-Daudé
2019-08-14 12:06 ` Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-08-07 13:34 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: kraxel
On 8/7/19 10:40 AM, Marc-André Lureau wrote:
> If interface_count is NO_INTERFACE_INFO, let's not access the arrays
> out-of-bounds.
>
> ==994==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000243930 at pc 0x5642068086a8 bp 0x7f0b6f9ffa50 sp 0x7f0b6f9ffa40
> READ of size 1 at 0x625000243930 thread T0
> #0 0x5642068086a7 in usbredir_check_bulk_receiving /home/elmarco/src/qemu/hw/usb/redirect.c:1503
> #1 0x56420681301c in usbredir_post_load /home/elmarco/src/qemu/hw/usb/redirect.c:2154
> #2 0x5642068a56c2 in vmstate_load_state /home/elmarco/src/qemu/migration/vmstate.c:168
> #3 0x56420688e2ac in vmstate_load /home/elmarco/src/qemu/migration/savevm.c:829
> #4 0x5642068980cb in qemu_loadvm_section_start_full /home/elmarco/src/qemu/migration/savevm.c:2211
> #5 0x564206899645 in qemu_loadvm_state_main /home/elmarco/src/qemu/migration/savevm.c:2395
> #6 0x5642068998cf in qemu_loadvm_state /home/elmarco/src/qemu/migration/savevm.c:2467
> #7 0x56420685f3e9 in process_incoming_migration_co /home/elmarco/src/qemu/migration/migration.c:449
> #8 0x564207106c47 in coroutine_trampoline /home/elmarco/src/qemu/util/coroutine-ucontext.c:115
> #9 0x7f0c0604e37f (/lib64/libc.so.6+0x4d37f)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> hw/usb/redirect.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index 998fc6e4b0..9764a57987 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -1495,6 +1495,11 @@ static void usbredir_check_bulk_receiving(USBRedirDevice *dev)
> for (i = EP2I(USB_DIR_IN); i < MAX_ENDPOINTS; i++) {
> dev->endpoint[i].bulk_receiving_enabled = 0;
> }
> +
> + if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
> + return;
> + }
> +
> for (i = 0; i < dev->interface_info.interface_count; i++) {
> quirks = usb_get_quirks(dev->device_info.vendor_id,
> dev->device_info.product_id,
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload
2019-08-07 8:40 [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload Marc-André Lureau
` (2 preceding siblings ...)
2019-08-07 13:34 ` Philippe Mathieu-Daudé
@ 2019-08-14 12:06 ` Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2019-08-14 12:06 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: qemu-devel
On Wed, Aug 07, 2019 at 12:40:48PM +0400, Marc-André Lureau wrote:
> If interface_count is NO_INTERFACE_INFO, let's not access the arrays
> out-of-bounds.
>
> ==994==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000243930 at pc 0x5642068086a8 bp 0x7f0b6f9ffa50 sp 0x7f0b6f9ffa40
> READ of size 1 at 0x625000243930 thread T0
> #0 0x5642068086a7 in usbredir_check_bulk_receiving /home/elmarco/src/qemu/hw/usb/redirect.c:1503
> #1 0x56420681301c in usbredir_post_load /home/elmarco/src/qemu/hw/usb/redirect.c:2154
> #2 0x5642068a56c2 in vmstate_load_state /home/elmarco/src/qemu/migration/vmstate.c:168
> #3 0x56420688e2ac in vmstate_load /home/elmarco/src/qemu/migration/savevm.c:829
> #4 0x5642068980cb in qemu_loadvm_section_start_full /home/elmarco/src/qemu/migration/savevm.c:2211
> #5 0x564206899645 in qemu_loadvm_state_main /home/elmarco/src/qemu/migration/savevm.c:2395
> #6 0x5642068998cf in qemu_loadvm_state /home/elmarco/src/qemu/migration/savevm.c:2467
> #7 0x56420685f3e9 in process_incoming_migration_co /home/elmarco/src/qemu/migration/migration.c:449
> #8 0x564207106c47 in coroutine_trampoline /home/elmarco/src/qemu/util/coroutine-ucontext.c:115
> #9 0x7f0c0604e37f (/lib64/libc.so.6+0x4d37f)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Added to usb queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-08-14 12:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 8:40 [Qemu-devel] [PATCH] usbredir: fix buffer-overflow on vmload Marc-André Lureau
2019-08-07 11:21 ` Liam Merwick
2019-08-07 11:30 ` Li Qiang
2019-08-07 13:34 ` Philippe Mathieu-Daudé
2019-08-14 12:06 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).