printk: finalize records with trailing newlines
John Ogness
maintainerPATCH 1/1 printk: finalize records with trailing newlines
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().
---
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(-)
kernel/printk/printk.c +2 -2
@@ -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);
Signature · 1 line
2.20.1
Quoted 6 lines · John Ogness
Any record with a trailing newline (
LOG_NEWLINEflag) 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 inlog_output()but was not handled correctly when committing inlog_store().
Quoted 8 lines
Fixes f5f022e53b87 ("printk: reimplement log_cont using record extension")Signed-off-by John Ogness <[email protected]>---
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.
Quoted 18 lines
kernel/printk/printk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/printk/printk.c +2
-2@@ -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);
Petr Mladek
maintainerQuoted 14 lines · Kefeng Wang
Quoted 12 lines · John Ogness
Any record with a trailing newline (
LOG_NEWLINEflag) 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 inlog_output()but was not handled correctly when committing inlog_store().Fixes f5f022e53b87 ("printk: reimplement log_cont using record extension")Signed-off-by John Ogness <[email protected]>---
This is an important bugfix for continuous messages and should be part of the 5.10 release.
Quoted 5 lines
Quoted 2 lines
If not applied, newlines will vanish when concatenating continuous with trailing newlines.
Thanks for you quick fix.
Reported-and-tested-by Kefeng Wang <[email protected]>
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