hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I91SQA CVE: NA
----------------------------------------
The following warning was found while testing the printk: pvqspinlock: lock 0xffffffffac56e1ac has corrupted value 0x0!
[ 3027.446208] WARNING: CPU: 2 PID: 0 at kernel/locking/qspinlock_paravirt.h:498 __pv_queued_spin_unlock_slowpath+0xc0/0xd0 [ 3027.446283] ? __pv_queued_spin_unlock_slowpath+0xc0/0xd0 [ 3027.446285] __raw_callee_save___pv_queued_spin_unlock_slowpath+0x11/0x24 [ 3027.446288] .slowpath+0x9/0x16 [ 3027.446292] console_unlock+0x265/0x3e0 [ 3027.446294] vprintk_emit+0x12b/0x150 [ 3027.446298] printk+0x58/0x73 [ 3027.446300] dump_stack_print_info+0x77/0xa0
This problem occurs because logbuf_lock that does not exist in the later version is not processed when the community patch 793d63aff1ee802d00cf2155182b379570f76c4e ("printk: Drop console_sem during panic")is adapted. Resolve the problem by reacquiring the lock before the break.
Fixes: 770a80b00211 ("[Backport] printk: Drop console_sem during panic") Signed-off-by: Ye Weihua yeweihua4@huawei.com --- kernel/printk/printk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index a1ac84498cf8..87cd50ae6cd6 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2495,7 +2495,7 @@ void console_unlock(void) static char text[LOG_LINE_MAX + PREFIX_MAX]; static int panic_console_dropped; unsigned long flags; - bool do_cond_resched, retry; + bool do_cond_resched, retry, locked = false; struct printk_info info; struct printk_record r;
@@ -2541,6 +2541,7 @@ void console_unlock(void)
printk_safe_enter_irqsave(flags); raw_spin_lock(&logbuf_lock); + locked = true; skip: if (!prb_read_valid(prb, console_seq, &r)) break; @@ -2588,6 +2589,7 @@ void console_unlock(void) console_msg_format & MSG_FORMAT_SYSLOG, printk_time); console_seq++; + locked = false; raw_spin_unlock(&logbuf_lock);
/* @@ -2619,7 +2621,8 @@ void console_unlock(void)
console_locked = 0;
- raw_spin_unlock(&logbuf_lock); + if (likely(locked)) + raw_spin_unlock(&logbuf_lock);
up_console_sem();
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/4580 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/A...
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/4580 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/A...