Bug 9450 - [devel-6.6] printk: Avoid logbuf_lock deadlock in oops_end()
Summary: [devel-6.6] printk: Avoid logbuf_lock deadlock in oops_end()
Status: NEW
Alias: None
Product: ANCK 6.6 Dev
Classification: ANCK
Component: X86 (show other bugs) X86
Version: unspecified
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: Guanjun
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-28 16:38 UTC by LeoLiu-oc
Modified: 2024-06-28 16:38 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LeoLiu-oc zhaoxin_group 2024-06-28 16:38:32 UTC
A CPU executing vprintk_emit might be interrupted by #PF exception,
this may leads to logbuf_lock deadlock:

CPU x:                            CPU x:
----                              ----
vprintk_emit()
  logbuf_lock_irqsave()
    printk_safe_enter_irqsave()
A:  raw_spin_lock(&logbuf_lock)
  vprintk_store()                 #PF
                                  do_page_fault
                                    ...
                                    oops_end
                                      bust_spinlocks(0)
                                        console_unlock()
                                          ...
                                          printk_safe_enter_irqsave()
B:                                        raw_spin_lock(&logbuf_lock)

logbuf_lock is taken at A and the deadlock happends at B.

Pass 1 to bust_spinlocks() in the oops_end() to avoid this deadlock.