提交 31ef67b0 编写于 作者: C Cheng Jian 提交者: Zheng Zengkai

printk: enable zap_locks on X86 and ARM64

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

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

Any architecture that involves an NMI should be treated with caution.
For example, the X86 architecture and ARM64 enabled PSEUDO NMI.
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c8ccc56f
......@@ -209,8 +209,12 @@ void show_regs_print_info(const char *log_lvl);
extern asmlinkage void dump_stack(void) __cold;
extern void printk_safe_flush(void);
extern void printk_safe_flush_on_panic(void);
#if defined(CONFIG_X86) || defined(CONFIG_ARM64_PSEUDO_NMI)
extern void zap_locks(void);
#else
static inline void zap_locks(void) { }
#endif
#else
static inline __printf(1, 0)
int vprintk(const char *s, va_list args)
{
......
......@@ -265,6 +265,7 @@ void panic(const char *fmt, ...)
crash_smp_send_stop();
}
#if defined(CONFIG_X86) || defined(CONFIG_ARM64_PSEUDO_NMI)
/*
* ZAP console related locks when nmi broadcast. If a crash is occurring,
* make sure we can't deadlock. And make sure that we print immediately.
......@@ -288,7 +289,6 @@ void panic(const char *fmt, ...)
* have a chance to see the messages. Others prefer to always
* reach emergency_restart() and reboot the machine.
*/
#ifdef CONFIG_X86
zap_locks();
#endif
......
......@@ -1742,6 +1742,7 @@ static DEFINE_RAW_SPINLOCK(console_owner_lock);
static struct task_struct *console_owner;
static bool console_waiter;
#if defined(CONFIG_X86) || defined(CONFIG_ARM64_PSEUDO_NMI)
void zap_locks(void)
{
if (raw_spin_is_locked(&logbuf_lock)) {
......@@ -1758,6 +1759,7 @@ void zap_locks(void)
sema_init(&console_sem, 1);
}
#endif
/**
* console_lock_spinning_enable - mark beginning of code where another
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册