All of lore.kernel.org
 help / color / mirror / Atom feed
* + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch
@ 2023-06-25  3:58 Andrew Morton
  2023-06-25 21:38 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrew Morton @ 2023-06-25  3:58 UTC (permalink / raw)
  To: mm-commits, zwp10758, senozhatsky, pc, mcgrof, keescook, joe,
	gregkh, tiozhang, akpm


The patch titled
     Subject: cred: convert printks to pr_<level>
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     cred-convert-printks-to-pr_level.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/cred-convert-printks-to-pr_level.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: tiozhang <tiozhang@didiglobal.com>
Subject: cred: convert printks to pr_<level>
Date: Sun, 25 Jun 2023 11:34:52 +0800

Use current logging style.

Link: https://lkml.kernel.org/r/20230625033452.GA22858@didi-ThinkCentre-M930t-N000
Signed-off-by: tiozhang <tiozhang@didiglobal.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Paulo Alcantara <pc@cjr.nz>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Weiping Zhang <zwp10758@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/cred.c |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

--- a/kernel/cred.c~cred-convert-printks-to-pr_level
+++ a/kernel/cred.c
@@ -4,6 +4,9 @@
  * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
  */
+
+#define pr_fmt(fmt) "CRED: " fmt
+
 #include <linux/export.h>
 #include <linux/cred.h>
 #include <linux/slab.h>
@@ -835,32 +838,32 @@ EXPORT_SYMBOL(creds_are_invalid);
 static void dump_invalid_creds(const struct cred *cred, const char *label,
 			       const struct task_struct *tsk)
 {
-	printk(KERN_ERR "CRED: %s credentials: %p %s%s%s\n",
+	pr_err("%s credentials: %p %s%s%s\n",
 	       label, cred,
 	       cred == &init_cred ? "[init]" : "",
 	       cred == tsk->real_cred ? "[real]" : "",
 	       cred == tsk->cred ? "[eff]" : "");
-	printk(KERN_ERR "CRED: ->magic=%x, put_addr=%p\n",
+	pr_err("->magic=%x, put_addr=%p\n",
 	       cred->magic, cred->put_addr);
-	printk(KERN_ERR "CRED: ->usage=%d, subscr=%d\n",
+	pr_err("->usage=%d, subscr=%d\n",
 	       atomic_read(&cred->usage),
 	       read_cred_subscribers(cred));
-	printk(KERN_ERR "CRED: ->*uid = { %d,%d,%d,%d }\n",
+	pr_err("->*uid = { %d,%d,%d,%d }\n",
 		from_kuid_munged(&init_user_ns, cred->uid),
 		from_kuid_munged(&init_user_ns, cred->euid),
 		from_kuid_munged(&init_user_ns, cred->suid),
 		from_kuid_munged(&init_user_ns, cred->fsuid));
-	printk(KERN_ERR "CRED: ->*gid = { %d,%d,%d,%d }\n",
+	pr_err("->*gid = { %d,%d,%d,%d }\n",
 		from_kgid_munged(&init_user_ns, cred->gid),
 		from_kgid_munged(&init_user_ns, cred->egid),
 		from_kgid_munged(&init_user_ns, cred->sgid),
 		from_kgid_munged(&init_user_ns, cred->fsgid));
 #ifdef CONFIG_SECURITY
-	printk(KERN_ERR "CRED: ->security is %p\n", cred->security);
+	pr_err("->security is %p\n", cred->security);
 	if ((unsigned long) cred->security >= PAGE_SIZE &&
 	    (((unsigned long) cred->security & 0xffffff00) !=
 	     (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8)))
-		printk(KERN_ERR "CRED: ->security {%x, %x}\n",
+		pr_err("->security {%x, %x}\n",
 		       ((u32*)cred->security)[0],
 		       ((u32*)cred->security)[1]);
 #endif
@@ -871,8 +874,8 @@ static void dump_invalid_creds(const str
  */
 void __noreturn __invalid_creds(const struct cred *cred, const char *file, unsigned line)
 {
-	printk(KERN_ERR "CRED: Invalid credentials\n");
-	printk(KERN_ERR "CRED: At %s:%u\n", file, line);
+	pr_err("Invalid credentials\n");
+	pr_err("At %s:%u\n", file, line);
 	dump_invalid_creds(cred, "Specified", current);
 	BUG();
 }
@@ -898,14 +901,14 @@ void __validate_process_creds(struct tas
 	return;
 
 invalid_creds:
-	printk(KERN_ERR "CRED: Invalid process credentials\n");
-	printk(KERN_ERR "CRED: At %s:%u\n", file, line);
+	pr_err("Invalid process credentials\n");
+	pr_err("At %s:%u\n", file, line);
 
 	dump_invalid_creds(tsk->real_cred, "Real", tsk);
 	if (tsk->cred != tsk->real_cred)
 		dump_invalid_creds(tsk->cred, "Effective", tsk);
 	else
-		printk(KERN_ERR "CRED: Effective creds == Real creds\n");
+		pr_err("Effective creds == Real creds\n");
 	BUG();
 }
 EXPORT_SYMBOL(__validate_process_creds);
_

Patches currently in -mm which might be from tiozhang@didiglobal.com are

cred-convert-printks-to-pr_level.patch


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch
  2023-06-25  3:58 + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch Andrew Morton
@ 2023-06-25 21:38 ` Joe Perches
  2023-06-26  6:08   ` Greg KH
  2023-06-26  6:14 ` Sergey Senozhatsky
  2023-06-26  6:41 ` Sergey Senozhatsky
  2 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2023-06-25 21:38 UTC (permalink / raw)
  To: Andrew Morton, mm-commits, zwp10758, senozhatsky, pc, mcgrof,
	keescook, gregkh, tiozhang

On Sat, 2023-06-24 at 20:58 -0700, Andrew Morton wrote:
> The patch titled
>      Subject: cred: convert printks to pr_<level>
> has been added to the -mm mm-nonmm-unstable branch.  Its filename is
>      cred-convert-printks-to-pr_level.patch
> 
> This patch will shortly appear at
>      https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/cred-convert-printks-to-pr_level.patch
> 
> This patch will later appear in the mm-nonmm-unstable branch at
>     git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> 
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next via the mm-everything
> branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there every 2-3 working days
> 
> ------------------------------------------------------
> From: tiozhang <tiozhang@didiglobal.com>
> Subject: cred: convert printks to pr_<level>
> Date: Sun, 25 Jun 2023 11:34:52 +0800
> 
> Use current logging style.
> 
> Link: https://lkml.kernel.org/r/20230625033452.GA22858@didi-ThinkCentre-M930t-N000
> Signed-off-by: tiozhang <tiozhang@didiglobal.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Joe Perches <joe@perches.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Paulo Alcantara <pc@cjr.nz>
> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> Cc: Weiping Zhang <zwp10758@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  kernel/cred.c |   27 +++++++++++++++------------
>  1 file changed, 15 insertions(+), 12 deletions(-)
> 
> --- a/kernel/cred.c~cred-convert-printks-to-pr_level
> +++ a/kernel/cred.c
> @@ -4,6 +4,9 @@
>   * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
>   * Written by David Howells (dhowells@redhat.com)
>   */
> +
> +#define pr_fmt(fmt) "CRED: " fmt

My preference would be to use

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

but it likely doesn't matter too much.

> +
>  #include <linux/export.h>
>  #include <linux/cred.h>
>  #include <linux/slab.h>
> @@ -835,32 +838,32 @@ EXPORT_SYMBOL(creds_are_invalid);
>  static void dump_invalid_creds(const struct cred *cred, const char *label,
>  			       const struct task_struct *tsk)
>  {
> -	printk(KERN_ERR "CRED: %s credentials: %p %s%s%s\n",
> +	pr_err("%s credentials: %p %s%s%s\n",
>  	       label, cred,
>  	       cred == &init_cred ? "[init]" : "",
>  	       cred == tsk->real_cred ? "[real]" : "",
>  	       cred == tsk->cred ? "[eff]" : "");
> -	printk(KERN_ERR "CRED: ->magic=%x, put_addr=%p\n",
> +	pr_err("->magic=%x, put_addr=%p\n",
>  	       cred->magic, cred->put_addr);
> -	printk(KERN_ERR "CRED: ->usage=%d, subscr=%d\n",
> +	pr_err("->usage=%d, subscr=%d\n",
>  	       atomic_read(&cred->usage),
>  	       read_cred_subscribers(cred));
> -	printk(KERN_ERR "CRED: ->*uid = { %d,%d,%d,%d }\n",
> +	pr_err("->*uid = { %d,%d,%d,%d }\n",
>  		from_kuid_munged(&init_user_ns, cred->uid),
>  		from_kuid_munged(&init_user_ns, cred->euid),
>  		from_kuid_munged(&init_user_ns, cred->suid),
>  		from_kuid_munged(&init_user_ns, cred->fsuid));
> -	printk(KERN_ERR "CRED: ->*gid = { %d,%d,%d,%d }\n",
> +	pr_err("->*gid = { %d,%d,%d,%d }\n",
>  		from_kgid_munged(&init_user_ns, cred->gid),
>  		from_kgid_munged(&init_user_ns, cred->egid),
>  		from_kgid_munged(&init_user_ns, cred->sgid),
>  		from_kgid_munged(&init_user_ns, cred->fsgid));
>  #ifdef CONFIG_SECURITY
> -	printk(KERN_ERR "CRED: ->security is %p\n", cred->security);
> +	pr_err("->security is %p\n", cred->security);
>  	if ((unsigned long) cred->security >= PAGE_SIZE &&
>  	    (((unsigned long) cred->security & 0xffffff00) !=
>  	     (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8)))
> -		printk(KERN_ERR "CRED: ->security {%x, %x}\n",
> +		pr_err("->security {%x, %x}\n",
>  		       ((u32*)cred->security)[0],
>  		       ((u32*)cred->security)[1]);
>  #endif
> @@ -871,8 +874,8 @@ static void dump_invalid_creds(const str
>   */
>  void __noreturn __invalid_creds(const struct cred *cred, const char *file, unsigned line)
>  {
> -	printk(KERN_ERR "CRED: Invalid credentials\n");
> -	printk(KERN_ERR "CRED: At %s:%u\n", file, line);
> +	pr_err("Invalid credentials\n");
> +	pr_err("At %s:%u\n", file, line);
>  	dump_invalid_creds(cred, "Specified", current);
>  	BUG();
>  }
> @@ -898,14 +901,14 @@ void __validate_process_creds(struct tas
>  	return;
>  
>  invalid_creds:
> -	printk(KERN_ERR "CRED: Invalid process credentials\n");
> -	printk(KERN_ERR "CRED: At %s:%u\n", file, line);
> +	pr_err("Invalid process credentials\n");
> +	pr_err("At %s:%u\n", file, line);
>  
>  	dump_invalid_creds(tsk->real_cred, "Real", tsk);
>  	if (tsk->cred != tsk->real_cred)
>  		dump_invalid_creds(tsk->cred, "Effective", tsk);
>  	else
> -		printk(KERN_ERR "CRED: Effective creds == Real creds\n");
> +		pr_err("Effective creds == Real creds\n");
>  	BUG();
>  }
>  EXPORT_SYMBOL(__validate_process_creds);
> _
> 
> Patches currently in -mm which might be from tiozhang@didiglobal.com are
> 
> cred-convert-printks-to-pr_level.patch
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch
  2023-06-25 21:38 ` Joe Perches
@ 2023-06-26  6:08   ` Greg KH
  2023-06-26  6:52     ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2023-06-26  6:08 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andrew Morton, mm-commits, zwp10758, senozhatsky, pc, mcgrof,
	keescook, tiozhang

On Sun, Jun 25, 2023 at 02:38:39PM -0700, Joe Perches wrote:
> On Sat, 2023-06-24 at 20:58 -0700, Andrew Morton wrote:
> > The patch titled
> >      Subject: cred: convert printks to pr_<level>
> > has been added to the -mm mm-nonmm-unstable branch.  Its filename is
> >      cred-convert-printks-to-pr_level.patch
> > 
> > This patch will shortly appear at
> >      https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/cred-convert-printks-to-pr_level.patch
> > 
> > This patch will later appear in the mm-nonmm-unstable branch at
> >     git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > 
> > Before you just go and hit "reply", please:
> >    a) Consider who else should be cc'ed
> >    b) Prefer to cc a suitable mailing list as well
> >    c) Ideally: find the original patch on the mailing list and do a
> >       reply-to-all to that, adding suitable additional cc's
> > 
> > *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> > 
> > The -mm tree is included into linux-next via the mm-everything
> > branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > and is updated there every 2-3 working days
> > 
> > ------------------------------------------------------
> > From: tiozhang <tiozhang@didiglobal.com>
> > Subject: cred: convert printks to pr_<level>
> > Date: Sun, 25 Jun 2023 11:34:52 +0800
> > 
> > Use current logging style.
> > 
> > Link: https://lkml.kernel.org/r/20230625033452.GA22858@didi-ThinkCentre-M930t-N000
> > Signed-off-by: tiozhang <tiozhang@didiglobal.com>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Joe Perches <joe@perches.com>
> > Cc: Kees Cook <keescook@chromium.org>
> > Cc: Luis Chamberlain <mcgrof@kernel.org>
> > Cc: Paulo Alcantara <pc@cjr.nz>
> > Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> > Cc: Weiping Zhang <zwp10758@gmail.com>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > ---
> > 
> >  kernel/cred.c |   27 +++++++++++++++------------
> >  1 file changed, 15 insertions(+), 12 deletions(-)
> > 
> > --- a/kernel/cred.c~cred-convert-printks-to-pr_level
> > +++ a/kernel/cred.c
> > @@ -4,6 +4,9 @@
> >   * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
> >   * Written by David Howells (dhowells@redhat.com)
> >   */
> > +
> > +#define pr_fmt(fmt) "CRED: " fmt
> 
> My preference would be to use
> 
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 
> but it likely doesn't matter too much.

The patch as-is keeps the messages identical to before, so it should
probably stay this way.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch
  2023-06-25  3:58 + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch Andrew Morton
  2023-06-25 21:38 ` Joe Perches
@ 2023-06-26  6:14 ` Sergey Senozhatsky
  2023-06-26  6:41 ` Sergey Senozhatsky
  2 siblings, 0 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2023-06-26  6:14 UTC (permalink / raw)
  To: Andrew Morton
  Cc: mm-commits, zwp10758, senozhatsky, pc, mcgrof, keescook, joe,
	gregkh, tiozhang

On (23/06/24 20:58), Andrew Morton wrote:
> 
> Use current logging style.
> 
> Link: https://lkml.kernel.org/r/20230625033452.GA22858@didi-ThinkCentre-M930t-N000
> Signed-off-by: tiozhang <tiozhang@didiglobal.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Joe Perches <joe@perches.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Paulo Alcantara <pc@cjr.nz>
> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> Cc: Weiping Zhang <zwp10758@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch
  2023-06-25  3:58 + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch Andrew Morton
  2023-06-25 21:38 ` Joe Perches
  2023-06-26  6:14 ` Sergey Senozhatsky
@ 2023-06-26  6:41 ` Sergey Senozhatsky
  2 siblings, 0 replies; 6+ messages in thread
From: Sergey Senozhatsky @ 2023-06-26  6:41 UTC (permalink / raw)
  To: Petr Mladek
  Cc: mm-commits, zwp10758, senozhatsky, pc, mcgrof, keescook, joe,
	gregkh, tiozhang, Andrew Morton

Cc-ing Petr on this for visibility.
Message-id: 20230625035813.A23CAC433C8@smtp.kernel.org

On (23/06/24 20:58), Andrew Morton wrote:
> The patch titled
>      Subject: cred: convert printks to pr_<level>
> has been added to the -mm mm-nonmm-unstable branch.  Its filename is
>      cred-convert-printks-to-pr_level.patch
> 
> This patch will shortly appear at
>      https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/cred-convert-printks-to-pr_level.patch
> 
> This patch will later appear in the mm-nonmm-unstable branch at
>     git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> 
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next via the mm-everything
> branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there every 2-3 working days
> 
> ------------------------------------------------------
> From: tiozhang <tiozhang@didiglobal.com>
> Subject: cred: convert printks to pr_<level>
> Date: Sun, 25 Jun 2023 11:34:52 +0800
> 
> Use current logging style.
> 
> Link: https://lkml.kernel.org/r/20230625033452.GA22858@didi-ThinkCentre-M930t-N000
> Signed-off-by: tiozhang <tiozhang@didiglobal.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Joe Perches <joe@perches.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Paulo Alcantara <pc@cjr.nz>
> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> Cc: Weiping Zhang <zwp10758@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  kernel/cred.c |   27 +++++++++++++++------------
>  1 file changed, 15 insertions(+), 12 deletions(-)
> 
> --- a/kernel/cred.c~cred-convert-printks-to-pr_level
> +++ a/kernel/cred.c
> @@ -4,6 +4,9 @@
>   * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
>   * Written by David Howells (dhowells@redhat.com)
>   */
> +
> +#define pr_fmt(fmt) "CRED: " fmt
> +
>  #include <linux/export.h>
>  #include <linux/cred.h>
>  #include <linux/slab.h>
> @@ -835,32 +838,32 @@ EXPORT_SYMBOL(creds_are_invalid);
>  static void dump_invalid_creds(const struct cred *cred, const char *label,
>  			       const struct task_struct *tsk)
>  {
> -	printk(KERN_ERR "CRED: %s credentials: %p %s%s%s\n",
> +	pr_err("%s credentials: %p %s%s%s\n",
>  	       label, cred,
>  	       cred == &init_cred ? "[init]" : "",
>  	       cred == tsk->real_cred ? "[real]" : "",
>  	       cred == tsk->cred ? "[eff]" : "");
> -	printk(KERN_ERR "CRED: ->magic=%x, put_addr=%p\n",
> +	pr_err("->magic=%x, put_addr=%p\n",
>  	       cred->magic, cred->put_addr);
> -	printk(KERN_ERR "CRED: ->usage=%d, subscr=%d\n",
> +	pr_err("->usage=%d, subscr=%d\n",
>  	       atomic_read(&cred->usage),
>  	       read_cred_subscribers(cred));
> -	printk(KERN_ERR "CRED: ->*uid = { %d,%d,%d,%d }\n",
> +	pr_err("->*uid = { %d,%d,%d,%d }\n",
>  		from_kuid_munged(&init_user_ns, cred->uid),
>  		from_kuid_munged(&init_user_ns, cred->euid),
>  		from_kuid_munged(&init_user_ns, cred->suid),
>  		from_kuid_munged(&init_user_ns, cred->fsuid));
> -	printk(KERN_ERR "CRED: ->*gid = { %d,%d,%d,%d }\n",
> +	pr_err("->*gid = { %d,%d,%d,%d }\n",
>  		from_kgid_munged(&init_user_ns, cred->gid),
>  		from_kgid_munged(&init_user_ns, cred->egid),
>  		from_kgid_munged(&init_user_ns, cred->sgid),
>  		from_kgid_munged(&init_user_ns, cred->fsgid));
>  #ifdef CONFIG_SECURITY
> -	printk(KERN_ERR "CRED: ->security is %p\n", cred->security);
> +	pr_err("->security is %p\n", cred->security);
>  	if ((unsigned long) cred->security >= PAGE_SIZE &&
>  	    (((unsigned long) cred->security & 0xffffff00) !=
>  	     (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8)))
> -		printk(KERN_ERR "CRED: ->security {%x, %x}\n",
> +		pr_err("->security {%x, %x}\n",
>  		       ((u32*)cred->security)[0],
>  		       ((u32*)cred->security)[1]);
>  #endif
> @@ -871,8 +874,8 @@ static void dump_invalid_creds(const str
>   */
>  void __noreturn __invalid_creds(const struct cred *cred, const char *file, unsigned line)
>  {
> -	printk(KERN_ERR "CRED: Invalid credentials\n");
> -	printk(KERN_ERR "CRED: At %s:%u\n", file, line);
> +	pr_err("Invalid credentials\n");
> +	pr_err("At %s:%u\n", file, line);
>  	dump_invalid_creds(cred, "Specified", current);
>  	BUG();
>  }
> @@ -898,14 +901,14 @@ void __validate_process_creds(struct tas
>  	return;
>  
>  invalid_creds:
> -	printk(KERN_ERR "CRED: Invalid process credentials\n");
> -	printk(KERN_ERR "CRED: At %s:%u\n", file, line);
> +	pr_err("Invalid process credentials\n");
> +	pr_err("At %s:%u\n", file, line);
>  
>  	dump_invalid_creds(tsk->real_cred, "Real", tsk);
>  	if (tsk->cred != tsk->real_cred)
>  		dump_invalid_creds(tsk->cred, "Effective", tsk);
>  	else
> -		printk(KERN_ERR "CRED: Effective creds == Real creds\n");
> +		pr_err("Effective creds == Real creds\n");
>  	BUG();
>  }
>  EXPORT_SYMBOL(__validate_process_creds);
> _
> 
> Patches currently in -mm which might be from tiozhang@didiglobal.com are
> 
> cred-convert-printks-to-pr_level.patch
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch
  2023-06-26  6:08   ` Greg KH
@ 2023-06-26  6:52     ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2023-06-26  6:52 UTC (permalink / raw)
  To: Greg KH
  Cc: Andrew Morton, mm-commits, zwp10758, senozhatsky, pc, mcgrof,
	keescook, tiozhang

On Mon, 2023-06-26 at 08:08 +0200, Greg KH wrote:
> On Sun, Jun 25, 2023 at 02:38:39PM -0700, Joe Perches wrote:
> > On Sat, 2023-06-24 at 20:58 -0700, Andrew Morton wrote:
> > > The patch titled
> > >      Subject: cred: convert printks to pr_<level>
> > > has been added to the -mm mm-nonmm-unstable branch.  Its filename is
> > >      cred-convert-printks-to-pr_level.patch
> > > 
> > > This patch will shortly appear at
> > >      https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/cred-convert-printks-to-pr_level.patch
> > > 
> > > This patch will later appear in the mm-nonmm-unstable branch at
> > >     git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > > 
> > > Before you just go and hit "reply", please:
> > >    a) Consider who else should be cc'ed
> > >    b) Prefer to cc a suitable mailing list as well
> > >    c) Ideally: find the original patch on the mailing list and do a
> > >       reply-to-all to that, adding suitable additional cc's
> > > 
> > > *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> > > 
> > > The -mm tree is included into linux-next via the mm-everything
> > > branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > > and is updated there every 2-3 working days
> > > 
> > > ------------------------------------------------------
> > > From: tiozhang <tiozhang@didiglobal.com>
> > > Subject: cred: convert printks to pr_<level>
> > > Date: Sun, 25 Jun 2023 11:34:52 +0800
> > > 
> > > Use current logging style.
> > > 
> > > Link: https://lkml.kernel.org/r/20230625033452.GA22858@didi-ThinkCentre-M930t-N000
> > > Signed-off-by: tiozhang <tiozhang@didiglobal.com>
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Cc: Joe Perches <joe@perches.com>
> > > Cc: Kees Cook <keescook@chromium.org>
> > > Cc: Luis Chamberlain <mcgrof@kernel.org>
> > > Cc: Paulo Alcantara <pc@cjr.nz>
> > > Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> > > Cc: Weiping Zhang <zwp10758@gmail.com>
> > > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > > ---
> > > 
> > >  kernel/cred.c |   27 +++++++++++++++------------
> > >  1 file changed, 15 insertions(+), 12 deletions(-)
> > > 
> > > --- a/kernel/cred.c~cred-convert-printks-to-pr_level
> > > +++ a/kernel/cred.c
> > > @@ -4,6 +4,9 @@
> > >   * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
> > >   * Written by David Howells (dhowells@redhat.com)
> > >   */
> > > +
> > > +#define pr_fmt(fmt) "CRED: " fmt
> > 
> > My preference would be to use
> > 
> > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > 
> > but it likely doesn't matter too much.
> 
> The patch as-is keeps the messages identical to before, so it should
> probably stay this way.

Generally these message prefixes are lowercase and the
dmesg output is not guaranteed to be stable.

One day it'd be trivially useful to standardize the
output style of pr_<foo> uses and remove the typical
pr_fmt defines and only use a define in exceptional cases

$ git grep -Ph 'define\s+pr_fmt\(' | \
  sed -r 's/\s+/ /g' | \
  sort | uniq -c | sort -rn | head -10
   1280 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
    145 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
     37 #define pr_fmt(fmt) "%s: " fmt, __func__
     22 #define pr_fmt(fmt) "ACPI: " fmt
     21 #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
     19 #define pr_fmt(fmt) fmt
     17 #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
     14 #define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
     13 #define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
     12 #define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-26  6:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-25  3:58 + cred-convert-printks-to-pr_level.patch added to mm-nonmm-unstable branch Andrew Morton
2023-06-25 21:38 ` Joe Perches
2023-06-26  6:08   ` Greg KH
2023-06-26  6:52     ` Joe Perches
2023-06-26  6:14 ` Sergey Senozhatsky
2023-06-26  6:41 ` Sergey Senozhatsky

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.