qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH] Fix changing password using monitor over VNC.


From: Jan Kiszka
Subject: [Qemu-devel] Re: [PATCH] Fix changing password using monitor over VNC.
Date: Fri, 17 Apr 2009 09:00:58 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

Zachary Amsden wrote:
> A simple segfault turned out to be a relatively complex fix.
> 
> The monitor calls back to main_loop_wait() to wait for the completion
> of the password change event; this results in a nested invocation of

This is no longer true with trunk as this nasty blocking password
reading has been converted into an async operation. Is your patch
required nevertheless? Or is this band-aid for stable?

> the associated I/O handlers.  For stdio monitor, this is okay, but VNC
> maintains an input buffer which is not flushed until after the
> invocation of protocol actions.  This is non-reentrant; the result is
> that the nested invocation consumes the same protocol event as the
> parent (which was a '\n', setting a NULL password), and it gets worse
> when both the child and the parent attempt to shift in the same input
> event, resulting in a memmove of size -1ULL, and a segfault.
> 
> The fix is to consume the input buffer before invoking protocol actions
> which may cause nested invocation of the handler; we must also set up
> the child handler to receive new events, which was cleanest done with
> vnc_read_when() from the protcol handler (doing it in the outer loop
> causes bugs with other types of waits, such as auth).  We return fed=1
> from the outer handler to prevent the logic in vnc_client_read from
> reconsuming the pre-consumed buffer, and simply reset the expect
> value to receive the next protocol command.
> 
> Signed-off-by: Zachary Amsden <address@hidden>
> ---

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]