* [PATCH] printk: finalize records with trailing newlines
@ 2020-11-26 11:48 John Ogness
2020-11-26 12:32 ` Kefeng Wang
0 siblings, 1 reply; 3+ messages in thread
From: John Ogness @ 2020-11-26 11:48 UTC (permalink / raw)
To: Petr Mladek
Cc: Sergey Senozhatsky, Sergey Senozhatsky, Steven Rostedt,
Linus Torvalds, Greg Kroah-Hartman, Kefeng Wang, Atish Patra,
linux-kernel
Any record with a trailing newline (LOG_NEWLINE flag) cannot
be continued because the newline has been stripped and will
not be visible if the message is appended. This was already
handled correctly when committing in log_output() but was
not handled correctly when committing in log_store().
Fixes: f5f022e53b87 ("printk: reimplement log_cont using record extension")
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
This is an important bugfix for continuous messages and should
be part of the 5.10 release.
If not applied, newlines will vanish when concatenating
continuous with trailing newlines.
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 fe64a49344bf..bc1e3b5a97bd 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -528,8 +528,8 @@ static int log_store(u32 caller_id, int facility, int level,
if (dev_info)
memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));
- /* insert message */
- if ((flags & LOG_CONT) || !(flags & LOG_NEWLINE))
+ /* A message without a trailing newline can be continued. */
+ if (!(flags & LOG_NEWLINE))
prb_commit(&e);
else
prb_final_commit(&e);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] printk: finalize records with trailing newlines
2020-11-26 11:48 [PATCH] printk: finalize records with trailing newlines John Ogness
@ 2020-11-26 12:32 ` Kefeng Wang
2020-11-27 12:39 ` Petr Mladek
0 siblings, 1 reply; 3+ messages in thread
From: Kefeng Wang @ 2020-11-26 12:32 UTC (permalink / raw)
To: John Ogness, Petr Mladek
Cc: Sergey Senozhatsky, Sergey Senozhatsky, Steven Rostedt,
Linus Torvalds, Greg Kroah-Hartman, Atish Patra, linux-kernel
On 2020/11/26 19:48, John Ogness wrote:
> Any record with a trailing newline (LOG_NEWLINE flag) cannot
> be continued because the newline has been stripped and will
> not be visible if the message is appended. This was already
> handled correctly when committing in log_output() but was
> not handled correctly when committing in log_store().
>
> Fixes: f5f022e53b87 ("printk: reimplement log_cont using record extension")
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> ---
> This is an important bugfix for continuous messages and should
> be part of the 5.10 release.
>
> If not applied, newlines will vanish when concatenating
> continuous with trailing newlines.
Thanks for you quick fix.
Reported-and-tested-by: Kefeng Wang <wangkefeng.wang@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 fe64a49344bf..bc1e3b5a97bd 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -528,8 +528,8 @@ static int log_store(u32 caller_id, int facility, int level,
> if (dev_info)
> memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));
>
> - /* insert message */
> - if ((flags & LOG_CONT) || !(flags & LOG_NEWLINE))
> + /* A message without a trailing newline can be continued. */
> + if (!(flags & LOG_NEWLINE))
> prb_commit(&e);
> else
> prb_final_commit(&e);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] printk: finalize records with trailing newlines
2020-11-26 12:32 ` Kefeng Wang
@ 2020-11-27 12:39 ` Petr Mladek
0 siblings, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2020-11-27 12:39 UTC (permalink / raw)
To: Kefeng Wang
Cc: John Ogness, Sergey Senozhatsky, Sergey Senozhatsky,
Steven Rostedt, Linus Torvalds, Greg Kroah-Hartman, Atish Patra,
linux-kernel
On Thu 2020-11-26 20:32:18, Kefeng Wang wrote:
>
> On 2020/11/26 19:48, John Ogness wrote:
> > Any record with a trailing newline (LOG_NEWLINE flag) cannot
> > be continued because the newline has been stripped and will
> > not be visible if the message is appended. This was already
> > handled correctly when committing in log_output() but was
> > not handled correctly when committing in log_store().
> >
> > Fixes: f5f022e53b87 ("printk: reimplement log_cont using record extension")
> > Signed-off-by: John Ogness <john.ogness@linutronix.de>
> > ---
> > This is an important bugfix for continuous messages and should
> > be part of the 5.10 release.
> >
> > If not applied, newlines will vanish when concatenating
> > continuous with trailing newlines.
> Thanks for you quick fix.
>
> Reported-and-tested-by: Kefeng Wang <wangkefeng.wang@huawei.com>
The patch is committed in printk/linux.git, branch
for-5.10-pr_cont-fixup.
I do not have much experience with pushing fixes this late in the
release cycle.
Normally, I would prefer to give it few days in linux-next. But
the fix is quite trivial. And it would be better to have it
in 10-rc6 rather than in rc7 that might be the last rc before
release.
Thanks a lot for report, fix, and testing.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-27 12:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 11:48 [PATCH] printk: finalize records with trailing newlines John Ogness
2020-11-26 12:32 ` Kefeng Wang
2020-11-27 12:39 ` Petr Mladek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.