[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] input: limit kbd queue depth
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] input: limit kbd queue depth |
Date: |
Fri, 28 Apr 2017 14:27:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Gerd Hoffmann <address@hidden> writes:
> Apply a limit to the number of items we accept into the keyboard queue.
>
> Impact: Without this limit vnc clients can exhaust host memory by
> sending keyboard events faster than qemu feeds them to the guest.
>
> Cc: P J P <address@hidden>
> Cc: Huawei PSIRT <address@hidden>
> Reported-by: address@hidden
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> ui/input.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/ui/input.c b/ui/input.c
> index ed88cda6d6..fb1f404095 100644
> --- a/ui/input.c
> +++ b/ui/input.c
> @@ -41,6 +41,8 @@ static QTAILQ_HEAD(QemuInputEventQueueHead,
> QemuInputEventQueue) kbd_queue =
> QTAILQ_HEAD_INITIALIZER(kbd_queue);
> static QEMUTimer *kbd_timer;
> static uint32_t kbd_default_delay_ms = 10;
> +static uint32_t queue_count;
> +static uint32_t queue_limit = 1024;
Drive-by comment, feel free to ignore: I'd be tempted to lower the limit
to something comparable to actual hardware, then dumb down the queue to
an array.
[...]