hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I991OV
--------------------------------
In the process of load testing against panic, a deadlock issue was discovered. The reason is that in the panic process, console_unlock doesn't handle the printk_context variable evenly, causing printk_context to overflow downwards, allowing vprintk_func to enter the nmi direct branch without disabling interrupt. Upon holding the logbuf_lock lock, an interrupt running wake_up_klogd_work_func was called, resulting in a deadlock.
To avoid this issue, move printk_safe_ext_irqrestore after check abandon_console_lock_in_panic().
Fixes: 7c2aff380e41 ([Backport] printk: Drop console_sem during panic) Signed-off-by: Ye Weihua yeweihua4@huawei.com --- kernel/printk/printk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 87cd50ae6cd6..ffd7f90b8f02 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2609,12 +2609,12 @@ void console_unlock(void) return; }
- printk_safe_exit_irqrestore(flags); - /* Allow panic_cpu to take over the consoles safely */ if (abandon_console_lock_in_panic()) break;
+ printk_safe_exit_irqrestore(flags); + if (do_cond_resched) cond_resched(); }
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/5269 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/T...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/5269 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/T...