arch/x86: get rid of KERN_CONT in show_fault_oops()
PATCH 1/1 arch/x86: get rid of KERN_CONT in show_fault_oops()
From: Dmitry Vyukov <[email protected]>
KERN_CONT leads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.
Only acceptable use of continuations is basically
boot-time testing.
Get rid of it.
--- arch/x86/mm/fault.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/mm/fault.c +3 -7
@@ -671,13 +671,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,printk (smep_warning,from_kuid (&init_user_ns,current_uid ())); } -printk (KERN_ALERT "BUG: unable to handle kernel " ); -if (address <PAGE_SIZE ) -printk (KERN_CONT "NULL pointer dereference" ); -else -printk (KERN_CONT "paging request" ); - -printk (KERN_CONT " at %px\n" , (void *) address); +printk (KERN_ALERT "BUG: unable to handle kernel %s at %px\n" , + (address <PAGE_SIZE ?"NULL pointer dereference" : +"paging request" ), (void *) address);dump_pagetable (address); }
Signature · 1 line
2.18.0.rc1.244.gcf134e6275-goog
Quoted 11 lines · Dmitry Vyukov
From: Dmitry Vyukov <[email protected]>
KERN_CONTleads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.Only acceptable use of continuations is basically
boot-time testing.Get rid of it.
arch/x86/mm/fault.c show_fault_oops(struct pt_regs *regs, unsigned long error_code, · line 676
Quoted 3 lines
arch/x86/mm/fault.c +3
-0+printk (KERN_ALERT "BUG: unable to handle kernel %s at %px\n" , + (address <PAGE_SIZE ?"NULL pointer dereference" : +"paging request" ), (void *) address);
Perhaps pr_alert() ?
Btw, parens are redundant for the first argument.
P.S. And personally I would rather do
if (address < PAGE_SIZE)
pr_alert(...NULL pointer dereference...);
else
pr_alert(...paging request...);
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · Andy Shevchenko
Quoted 9 lines · Dmitry Vyukov
From: Dmitry Vyukov <[email protected]>
KERN_CONTleads to split lines in kernel output
and complicates useful changes to printk like
printing context before each line.Only acceptable use of continuations is basically
boot-time testing.
Quoted 7 lines
arch/x86/mm/fault.c show_fault_oops(struct pt_regs *regs, unsigned long error_code, · line 676
Quoted 5 lines
Get rid of it.
arch/x86/mm/fault.c +3
-0+printk (KERN_ALERT "BUG: unable to handle kernel %s at %px\n" , + (address <PAGE_SIZE ?"NULL pointer dereference" : +"paging request" ), (void *) address);Perhaps
pr_alert()?
It's the same, right? Make sense.
Quoted 7 lines
Btw, parens are redundant for the first argument.
P.S. And personally I would rather do
if (address <PAGE_SIZE)
pr_alert(...NULL pointer dereference...);
else
pr_alert(...paging request...);
It's kinda shorter this way. Any other opinions?
pr_alert("BUG: unable to handle kernel %s at %px\n",
address < PAGE_SIZE ? "NULL pointer dereference" :
"paging request", (void *) address);
vs:
if (address < PAGE_SIZE)
pr_alert("BUG: unable to handle kernel NULL pointer
dereference at %px\n",
(void *) address);
else
pr_alert("BUG: unable to handle kernel paging request at %px\n",
(void *) address);
Or, should we just do:
pr_alert("BUG: unable to handle kernel paging request at %px\n",
(void *) address);
and not try to be too smart here? In the end, that can be a NULL deref with 5K offset, right?
Quoted 8 lines · Dmitry Vyukov
Quoted 6 lines
arch/x86/mm/fault.c show_fault_oops(struct pt_regs *regs, unsigned long error_code, · line 676
Quoted 4 lines
arch/x86/mm/fault.c +3
-0+printk (KERN_ALERT "BUG: unable to handle kernel %s at %px\n" , + (address <PAGE_SIZE ?"NULL pointer dereference" : +"paging request" ), (void *) address);Perhaps
pr_alert()?It's the same, right? Make sense.
Right.
In printk(KERN_<LEVEL> ...) people tend to forget KERN_<LEVEL> sometimes, so, I think, in general we want to see more pr_foo() and less printk().
-ss
Quoted 6 lines · Sergey Senozhatsky
Quoted 5 lines · Dmitry Vyukov
Quoted 5 lines
Quoted 4 lines
arch/x86/mm/fault.c +3
-0+printk (KERN_ALERT "BUG: unable to handle kernel %s at %px\n" , + (address <PAGE_SIZE ?"NULL pointer dereference" : +"paging request" ), (void *) address);
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Perhaps
pr_alert()?It's the same, right? Make sense.
Right.
In
printk(KERN_<LEVEL> ...)people tend to forget KERN_<LEVEL> sometimes, so, I think, in general we want to see morepr_foo()and lessprintk().
Mailed v2 with pr_alert().
Since nobody else commented on single pr_alert() with ternary operator vs if + 2 pr_alert()'s, I left it intact for now.