提交 c8ccc56f 编写于 作者: C Chen Zhou 提交者: Zheng Zengkai

printk: fix potential deadlock in printk()

hulk inclusion
category: bugfix
bugzilla: 34546, https://gitee.com/openeuler/kernel/issues/I4JKT1
CVE: NA

----------------------------------------

When one cpu panic, the panic cpu send NMI to other cpus, if one of
the non-panic cpus is in printk() and get stopped in function
console_trylock_spinning() before releasing sem->lock, the panic cpu
may spin waiting sem->lock in function console_trylock_spinning().

Reinit console_sem in zap_lock() to fix this.
Signed-off-by: NChen Zhou <chenzhou10@huawei.com>
Reviewed-by: NJian Cheng <cj.chengjian@huawei.com>
Signed-off-by: NChen Zhou <chenzhou10@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 721cc05b
...@@ -1755,6 +1755,8 @@ void zap_locks(void) ...@@ -1755,6 +1755,8 @@ void zap_locks(void)
console_owner = NULL; console_owner = NULL;
console_waiter = false; console_waiter = false;
sema_init(&console_sem, 1);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册