mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Subject: Re: [PATCH] xen: avoid deadlock in xenbus
Date: Fri, 28 Jul 2017 17:16:34 +0200	[thread overview]
Message-ID: <09616301-1587-d5d5-a1dd-10ea74992339@suse.com> (raw)
In-Reply-To: <71819268-dd53-a60f-5759-b3ae1ce486d4@oracle.com>

On 28/07/17 17:14, Boris Ostrovsky wrote:
> On 07/28/2017 10:53 AM, Juergen Gross wrote:
>> When starting the xenwatch thread a theoretical deadlock situation is
>> possible:
>>
>> xs_init() contains:
>>
>>     task = kthread_run(xenwatch_thread, NULL, "xenwatch");
>>     if (IS_ERR(task))
>>         return PTR_ERR(task);
>>     xenwatch_pid = task->pid;
>>
>> And xenwatch_thread() does:
>>
>>     mutex_lock(&xenwatch_mutex);
>>     ...
>>     event->handle->callback();
>>     ...
>>     mutex_unlock(&xenwatch_mutex);
>>
>> The callback could call unregister_xenbus_watch() which does:
>>
>>     ...
>>     if (current->pid != xenwatch_pid)
>>         mutex_lock(&xenwatch_mutex);
>>     ...
>>
>> In case a watch is firing before xenwatch_pid could be set and the
>> callback of that watch unregisters a watch, then a self-deadlock would
>> occur.
>>
>> Avoid this by setting xenwatch_pid in xenwatch_thread().
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> 
> +stable?

As this problem is purely theoretical, I don't think the patch is
appropriate for stable (at least the stable rules tell me so).


Juergen

      reply	other threads:[~2017-07-28 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 14:53 Juergen Gross
2017-07-28 15:14 ` Boris Ostrovsky
2017-07-28 15:16   ` Juergen Gross [this message]

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=09616301-1587-d5d5-a1dd-10ea74992339@suse.com \
    --to=jgross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.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

all inboxes | Powered by JetHome®