From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: Julien Grall <julien.grall@linaro.org>, xen-devel@lists.xen.org
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com
Subject: Re: [PATCH for-4.10] libs/evtchn: Remove active handler on clean-up or failure
Date: Mon, 13 Nov 2017 09:04:24 +0000 [thread overview]
Message-ID: <211592d4-a5bf-8b39-3d99-38a0bccf5903@citrix.com> (raw)
In-Reply-To: <20171110171050.19836-1-julien.grall@linaro.org>
On 11/10/2017 05:10 PM, Julien Grall wrote:
> Commit 89d55473ed16543044a31d1e0d4660cf5a3f49df "xentoolcore_restrict_all:
> Implement for libxenevtchn" added a call to register allowing to
> restrict the event channel.
>
> However, the call to deregister the handler was not performed if open
> failed or when closing the event channel. This will result to corrupt
> the list of handlers and potentially crash the application later one.
>
> Fix it by calling xentoolcore_deregister_active_handle on failure and
> closure.
Thanks for fixing this.
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>
> ---
>
> This patch is fixing a bug introduced after the code freeze by
> "xentoolcore_restrict_all: Implement for libxenevtchn".
>
> The call to xentoolcore_deregister_active_handle is done at the same
> place as for the grants. But I am not convinced this is thread safe as
> there are potential race between close the event channel and restict
> handler. Do we care about that?
Both xentoolcore__deregister_active_handle() and
xentoolcore_restrict_all() hold the same lock when mutating the list so
there shouldn't be a problem with the list itself.
However, I think it should call xentoolcore__deregister_active_handle()
_before_ calling osdep_evtchn_close() to avoid trying to restrict a
closed fd or some other fd that happens to have the same number.
I think all the other libs need to be fixed as well, unless there was a
reason it was done this way.
--
Ross Lagerwall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-11-13 9:04 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 [this message]
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
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=211592d4-a5bf-8b39-3d99-38a0bccf5903@citrix.com \
--to=ross.lagerwall@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=julien.grall@linaro.org \
--cc=wei.liu2@citrix.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 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).