[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] vl.c: set NULL upon deleting handlers in qe
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] vl.c: set NULL upon deleting handlers in qemu_set_fd_handler2() |
Date: |
Tue, 25 Jan 2011 10:03:52 +0000 |
On Tue, Jan 25, 2011 at 8:33 AM, Corentin Chary
<address@hidden> wrote:
> From: Yoshiaki Tamura <address@hidden>
>
> Currently qemu_set_fd_handler2() is only setting ioh->deleted upon
> deleting. This may cause a crash when a read handler calls
> qemu_set_fd_handler2() to delete handlers, but a write handler is
> still invoked from main_loop_wait(). Because main_loop_wait() checks
> handlers before calling, setting NULL upon deleting will protect
> handlers being called if already deleted.
>
> One example is the new threaded vnc server. When an error occurs in
> the context of a read handler, it'll releases resources and deletes
> handlers. However, because the write handler still exists, it'll be
> called, and then crashes because of lack of resources. This patch
> fixes it.
Does this case still happen with qemu.git/master? In November I sent
a patch to check for deleted handlers:
commit 0290b57bdfec83ca78b6d119ea9847bb17943328
Author: Stefan Hajnoczi <address@hidden>
Date: Wed Nov 3 14:29:44 2010 +0000
Delete IOHandlers after potentially running them
Since commit 4bed9837309e58d208183f81d8344996744292cf an .fd_read()
handler that deletes its IOHandler is exposed to .fd_write() being
called on the deleted IOHandler.
This patch fixes deletion so that .fd_read() and .fd_write() are never
called on an IOHandler that is marked for deletion.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
So I don't think Yoshi's patch is necessary anymore?
Stefan
[Qemu-devel] [PATCH 3/7] Add support for glib based threading and convert qemu thread to use it, Anthony Liguori, 2011/01/24
[Qemu-devel] [PATCH 7/7] Rename QemuThread to QemuSThread to indicate that it is not a generic thread, Anthony Liguori, 2011/01/24
[Qemu-devel] [PATCH 6/7] Teach vnc server to use GThread directly, Anthony Liguori, 2011/01/24
[Qemu-devel] [PATCH 4/7] Get rid of QemuMutex and teach its callers about GStaticMutex, Anthony Liguori, 2011/01/24