From: Gerd Hoffmann <kraxel@redhat.com>
To: Xen Development Mailing List <xen-devel@lists.xensource.com>
Subject: [patch] Fix use-after-free in xenconsoled.
Date: Thu, 01 Nov 2007 14:59:58 +0100 [thread overview]
Message-ID: <4729DBDE.9080507@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
Hi,
shutdown_domain() MUST NOT call cleanup_domain(), just flagging them as
dead is enough. cleanup_domains() for dead domains is called by the
mainloop in handle_io() in a safe way already.
shutdown_domain() calling cleanup_domain() too leads struct domain being
accessed after freeing and to a double-free.
Fixed by simply dropping the cleanup_domain() call and by making the
functions called by the main loop in handle_io() ignore dead domains.
please apply,
Gerd
[-- Attachment #2: fix --]
[-- Type: text/plain, Size: 1620 bytes --]
Fix use-after-free in xenconsoled.
shutdown_domain() MUST NOT call cleanup_domain(), just flagging them as
dead is enough. cleanup_domains() for dead domains is called by the main
loop in handle_io() in a safe way already.
shutdown_domain() calling cleanup_domain() too leads struct domain being
accessed after freeing and to a double-free.
Fixed by simply dropping the cleanup_domain() call and by making the
functions called by the main loop in handle_io() ignore dead domains.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
diff -r c0b0974fb055 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Fri May 18 16:59:32 2007 +0100
+++ b/tools/console/daemon/io.c Thu Nov 01 14:47:49 2007 +0100
@@ -467,7 +467,6 @@ static void shutdown_domain(struct domai
if (d->xce_handle != -1)
xc_evtchn_close(d->xce_handle);
d->xce_handle = -1;
- cleanup_domain(d);
}
void enum_domains(void)
@@ -513,6 +512,9 @@ static void handle_tty_read(struct domai
struct xencons_interface *intf = dom->interface;
XENCONS_RING_IDX prod;
+ if (dom->is_dead)
+ return;
+
len = ring_free_bytes(dom);
if (len == 0)
return;
@@ -550,6 +552,9 @@ static void handle_tty_write(struct doma
{
ssize_t len;
+ if (dom->is_dead)
+ return;
+
len = write(dom->tty_fd, dom->buffer.data + dom->buffer.consumed,
dom->buffer.size - dom->buffer.consumed);
if (len < 1) {
@@ -572,6 +577,9 @@ static void handle_ring_read(struct doma
static void handle_ring_read(struct domain *dom)
{
evtchn_port_t port;
+
+ if (dom->is_dead)
+ return;
if ((port = xc_evtchn_pending(dom->xce_handle)) == -1)
return;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2007-11-01 13:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4729DBDE.9080507@redhat.com \
--to=kraxel@redhat.com \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.