diff options
author | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> | 2018-09-28 18:53:04 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-24 08:19:45 +0100 |
commit | 671ce9f892b93fb1e98ac2977f705a0fd301b0cb (patch) | |
tree | 4d7cefcde33236eab57574438d0ca9662aef08de /LICENSES/other | |
parent | cd120df118d7e9fc3320a2e4eb56f0fef88ae1f4 (diff) | |
download | linux-stable-671ce9f892b93fb1e98ac2977f705a0fd301b0cb.tar.gz linux-stable-671ce9f892b93fb1e98ac2977f705a0fd301b0cb.tar.bz2 linux-stable-671ce9f892b93fb1e98ac2977f705a0fd301b0cb.zip |
printk: CON_PRINTBUFFER console registration is a bit racy
[ Upstream commit 884e370ea88c109a3b982f4eb9ecd82510a3a1fe ]
CON_PRINTBUFFER console registration requires us to do several
preparation steps:
- Rollback console_seq to replay logbuf messages which were already
seen on other consoles;
- Set exclusive_console flag so console_unlock() will ->write() logbuf
messages only to the exclusive_console driver.
The way we do it, however, is a bit racy
logbuf_lock_irqsave(flags);
console_seq = syslog_seq;
console_idx = syslog_idx;
logbuf_unlock_irqrestore(flags);
<< preemption enabled
<< irqs enabled
exclusive_console = newcon;
console_unlock();
We rollback console_seq under logbuf_lock with IRQs disabled, but
we set exclusive_console with local IRQs enabled and logbuf unlocked.
If the system oops-es or panic-s before we set exclusive_console - and
given that we have IRQs and preemption enabled there is such a
possibility - we will re-play all logbuf messages to every registered
console, which may be a bit annoying and time consuming.
Move exclusive_console assignment to the same IRQs-disabled and
logbuf_lock-protected section where we rollback console_seq.
Link: http://lkml.kernel.org/r/20180928095304.9972-1-sergey.senozhatsky@gmail.com
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'LICENSES/other')
0 files changed, 0 insertions, 0 deletions