All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: "Jürgen Groß" <jgross@suse.com>
Cc: xen-devel@lists.xen.org
Subject: Re: xenstored file descriptor leak
Date: Wed, 3 Feb 2021 12:48:32 +0100	[thread overview]
Message-ID: <20210203114832.GA1549@antioche.eu.org> (raw)
In-Reply-To: <89ddaac0-eb05-8ddb-465a-60d78e4009eb@suse.com>

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

On Wed, Feb 03, 2021 at 09:21:32AM +0100, Jürgen Groß wrote:
> [...]
> This shouldn't happen in case we are closing the socket actively.
> 
> In the end we should just do a talloc_free(conn) in
> ignore_connection() if it is a socket based one. This should revert
> the critical modification of the XSA-115 fixes for sockets while
> keeping the desired effect for domain connections.

Hello
here's an updated patch which works for me. Does anyone see a problem
with it ? If not I will submit it for commit.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

[-- Attachment #2: xenstored_core.diff --]
[-- Type: text/plain, Size: 764 bytes --]

--- xenstored_core.c.orig	2021-02-02 18:06:33.389316841 +0100
+++ xenstored_core.c	2021-02-03 12:46:17.204376338 +0100
@@ -397,9 +397,12 @@
 			     !list_empty(&conn->out_list)))
 				*ptimeout = 0;
 		} else {
-			short events = POLLIN|POLLPRI;
-			if (!list_empty(&conn->out_list))
-				events |= POLLOUT;
+			short events = 0;
+			if (!conn->is_ignored) {
+				events |= POLLIN|POLLPRI;
+			        if (!list_empty(&conn->out_list))
+				        events |= POLLOUT;
+			}
 			conn->pollfd_idx = set_fd(conn->fd, events);
 		}
 	}
@@ -1440,6 +1443,9 @@
 
 	talloc_free(conn->in);
 	conn->in = NULL;
+	/* if this is a socket connection, drop it now */
+	if (conn->fd >= 0)
+		talloc_free(conn);
 }
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type)

  reply	other threads:[~2021-02-03 11:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 18:37 xenstored file descriptor leak Manuel Bouyer
2021-02-03  6:18 ` Jürgen Groß
2021-02-03  7:57   ` Manuel Bouyer
2021-02-03  8:05     ` Jürgen Groß
2021-02-03  8:16       ` Manuel Bouyer
2021-02-03  8:21         ` Jürgen Groß
2021-02-03 11:48           ` Manuel Bouyer [this message]
2021-02-03 11:54             ` Jürgen Groß
2021-02-03 12:03               ` Manuel Bouyer
2021-02-03 12:13                 ` Jürgen Groß
2021-02-03 12:17                   ` Manuel Bouyer
2021-02-03 12:21                     ` Jürgen Groß
2021-02-03 12:33                       ` Manuel Bouyer
2021-02-03 12:42                         ` Jürgen Groß
2021-02-03 12:47                           ` Manuel Bouyer
2021-02-03 12:58                             ` Jürgen Groß
2021-02-03 13:03                               ` Manuel Bouyer
2021-02-03 13:11                                 ` Jürgen Groß
2021-02-03 13:24                                   ` Manuel Bouyer

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=20210203114832.GA1549@antioche.eu.org \
    --to=bouyer@antioche.eu.org \
    --cc=jgross@suse.com \
    --cc=xen-devel@lists.xen.org \
    /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.