mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>, jgross@suse.com
Cc: xen-devel@lists.xenproject.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [BUG] xen: Two possible sleep-in-atomic-context bugs in bind_evtchn_to_irqhandler()
Date: Wed, 20 Jun 2018 10:49:28 +0800	[thread overview]
Message-ID: <80315b22-63c1-c8cc-1035-11fa36bee83a@gmail.com> (raw)

The driver may sleep with holding a spinlock.
The function call paths (from bottom to top) in Linux-4.16.7 are:

[FUNC] mutex_lock_nested --> can sleep
drivers/xen/events/events_base.c, 839: mutex_lock_nested in 
bind_evtchn_to_irq
drivers/xen/events/events_base.c, 1030: bind_evtchn_to_irq in 
bind_evtchn_to_irqhandler
drivers/xen/pvcalls-front.c, 371: bind_evtchn_to_irqhandler in create_active
drivers/xen/pvcalls-front.c, 417: create_active in pvcalls_front_connect
drivers/xen/pvcalls-front.c, 410: spin_lock in pvcalls_front_connect

[FUNC] request_irq --> can sleep
drivers/xen/events/events_base.c, 1003: request_irq in 
bind_evtchn_to_irqhandler
drivers/xen/pvcalls-front.c, 371: bind_evtchn_to_irqhandler in create_active
drivers/xen/pvcalls-front.c, 417: create_active in pvcalls_front_connect
drivers/xen/pvcalls-front.c, 410: spin_lock in pvcalls_front_connect

These bugs are found by my static analysis tool (DSAC-2) and checked by my
code review.

I do not know how to correctly fix these bugs, so I just report them.
Maybe create_active() should not be called with holding a spinlock.


Best wishes,
Jia-Ju Bai

             reply	other threads:[~2018-06-20  2:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20  2:49 Jia-Ju Bai [this message]
2018-06-20  6:57 ` Juergen Gross

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=80315b22-63c1-c8cc-1035-11fa36bee83a@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.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

Powered by JetHome