qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel@nongnu.org
Cc: Zachary Amsden <zamsden@redhat.com>
Subject: [Qemu-devel] Re: [PATCH] Fix changing password using monitor over VNC.
Date: Fri, 17 Apr 2009 09:00:58 +0200	[thread overview]
Message-ID: <49E8292A.8080900@web.de> (raw)
In-Reply-To: <1239944809-14327-1-git-send-email-zamsden@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1554 bytes --]

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 <zamsden@redhat.com>
> ---

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

  reply	other threads:[~2009-04-17  7:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17  5:06 [Qemu-devel] [PATCH] Fix changing password using monitor over VNC Zachary Amsden
2009-04-17  7:00 ` Jan Kiszka [this message]
2009-04-17  7:43   ` [Qemu-devel] " Zachary Amsden
2009-04-17  8:31     ` Jan Kiszka
2009-04-18  3:31       ` Zachary Amsden
2009-04-18  8:41         ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49E8292A.8080900@web.de \
    --to=jan.kiszka@web.de \
    --cc=qemu-devel@nongnu.org \
    --cc=zamsden@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).