WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Do not create the console tty until domain_create_ring h

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Do not create the console tty until domain_create_ring has succeeded. This
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 24 Oct 2005 14:18:07 +0000
Delivery-date: Mon, 24 Oct 2005 14:15:45 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID e6591119fda0e488ece39e007f725ed011709996
# Parent  1c62a4149b11fd3af95eaf97bc35fc26292698ae
Do not create the console tty until domain_create_ring has succeeded.  This
means that any reads attempted on that tty will not cause handle_tty_read to
segfault looking for an interface that does not exist.

Move the writing of the tty node so that it happens after console/limit has
been read, as it is cleaner if the writing is the last thing that happens.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 1c62a4149b11 -r e6591119fda0 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Mon Oct 24 07:04:38 2005
+++ b/tools/console/daemon/io.c Mon Oct 24 13:11:07 2005
@@ -163,6 +163,16 @@
                        tcsetattr(master, TCSAFLUSH, &term);
                }
 
+               success = asprintf(&path, "%s/limit", dom->conspath) != -1;
+               if (!success)
+                       goto out;
+               data = xs_read(xs, NULL, path, &len);
+               if (data) {
+                       dom->buffer.max_capacity = strtoul(data, 0, 0);
+                       free(data);
+               }
+               free(path);
+
                success = asprintf(&path, "%s/tty", dom->conspath) != -1;
                if (!success)
                        goto out;
@@ -170,16 +180,6 @@
                free(path);
                if (!success)
                        goto out;
-
-               success = asprintf(&path, "%s/limit", dom->conspath) != -1;
-               if (!success)
-                       goto out;
-               data = xs_read(xs, NULL, path, &len);
-               if (data) {
-                       dom->buffer.max_capacity = strtoul(data, 0, 0);
-                       free(data);
-               }
-               free(path);
        }
 
        return master;
@@ -269,6 +269,18 @@
        }
        dom->local_port = rc;
 
+       if (dom->tty_fd == -1) {
+               dom->tty_fd = domain_create_tty(dom);
+
+               if (dom->tty_fd == -1) {
+                       err = errno;
+                       close(dom->evtchn_fd);
+                       dom->evtchn_fd = -1;
+                       dom->local_port = -1;
+                       goto out;
+               }
+       }
+
  out:
        return err;
 }
@@ -309,7 +321,7 @@
        dom->conspath = s;
        strcat(dom->conspath, "/console");
 
-       dom->tty_fd = domain_create_tty(dom);
+       dom->tty_fd = -1;
        dom->is_dead = false;
        dom->buffer.data = 0;
        dom->buffer.size = 0;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Do not create the console tty until domain_create_ring has succeeded. This, Xen patchbot -unstable <=