xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Wei Liu <wei.liu2@citrix.com>, Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>,
	xen-devel@lists.xensource.com
Subject: Re: [PATCH] tools: xentoolcore_restrict_all: Do deregistration before close
Date: Tue, 14 Nov 2017 14:19:39 +0000	[thread overview]
Message-ID: <e865c47f-7d62-1a2d-9da8-38bb47510d6b@linaro.org> (raw)
In-Reply-To: <20171114140242.tov6gsbx35vbbjwx@citrix.com>

Hi,

On 14/11/17 14:02, Wei Liu wrote:
> On Tue, Nov 14, 2017 at 12:15:42PM +0000, Ian Jackson wrote:
>> Closing the fd before unhooking it from the list runs the risk that a
>> concurrent thread calls xentoolcore_restrict_all will operate on the
>> old fd value, which might refer to a new fd by then.  So we need to do
>> it in the other order.
>>
>> Sadly this weakens the guarantee provided by xentoolcore_restrict_all
>> slight, but not (I think) in a problematic way.  It would be possible
> 
> slightly
> 
>> to implement the previous guarantee, but it would involve replacing
>> all of the close() calls in all of the individual osdep parts of all
>> of the individual libraries with calls to a new function which does
>>     dup2("/dev/null", thing->fd);
>>     pthread_mutex_lock(&handles_lock);
>>     thing->fd = -1;
>>     pthread_mutex_unlock(&handles_lock);
>>     close(fd);
>> which would be terribly tedious.
>>
>> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

I think this is 4.10 material, xentoolcore was introduced in this 
release and it would be good to have it right from now. I want to 
confirm that you are both happy with that?

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-11-14 14:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 17:10 [PATCH for-4.10] libs/evtchn: Remove active handler on clean-up or failure Julien Grall
2017-11-13  9:04 ` Ross Lagerwall
2017-11-14 11:51   ` Ian Jackson
2017-11-14 12:05     ` Ross Lagerwall
2017-11-14 12:15       ` Ian Jackson
2017-11-14 12:14     ` Julien Grall
2017-11-14 13:53       ` Wei Liu
2017-11-14 14:26         ` Julien Grall
2017-11-14 12:15     ` [PATCH] tools: xentoolcore_restrict_all: Do deregistration before close Ian Jackson
2017-11-14 14:02       ` Wei Liu
2017-11-14 14:19         ` Julien Grall [this message]
2017-11-14 14:57           ` [PATCH for-4.10] " Ian Jackson
2017-11-16 15:01             ` Julien Grall
2017-11-14 14:26       ` [PATCH] " Ross Lagerwall
2017-11-14 15:01         ` Ian Jackson

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=e865c47f-7d62-1a2d-9da8-38bb47510d6b@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.jackson@eu.citrix.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=wei.liu2@citrix.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 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).