mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG] xen: Two possible sleep-in-atomic-context bugs in bind_evtchn_to_irqhandler()
@ 2018-06-20  2:49 Jia-Ju Bai
  2018-06-20  6:57 ` Juergen Gross
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-06-20  2:49 UTC (permalink / raw)
  To: Boris Ostrovsky, jgross; +Cc: xen-devel, Linux Kernel Mailing List

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-20  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-20  2:49 [BUG] xen: Two possible sleep-in-atomic-context bugs in bind_evtchn_to_irqhandler() Jia-Ju Bai
2018-06-20  6:57 ` Juergen Gross

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