From: Serge Hallyn <serge.hallyn@ubuntu.com>
To: Joe Perches <joe@perches.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>,
linux-security-module <linux-security-module@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] capability: Use current logging styles
Date: Fri, 21 Feb 2014 16:48:10 -0600 [thread overview]
Message-ID: <20140221224810.GA24302@sergelap> (raw)
In-Reply-To: <1393021170.2594.24.camel@joe-AO722>
Quoting Joe Perches (joe@perches.com):
> Prefix logging output with "capability: " via pr_fmt.
> Convert printks to pr_<level>.
> Use pr_<level>_once instead of guard flags.
> Coalesce formats.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Thanks.
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
> ---
> kernel/capability.c | 29 ++++++++++-------------------
> 1 file changed, 10 insertions(+), 19 deletions(-)
>
> diff --git a/kernel/capability.c b/kernel/capability.c
> index 34019c5..a8d63df 100644
> --- a/kernel/capability.c
> +++ b/kernel/capability.c
> @@ -7,6 +7,8 @@
> * 30 May 2002: Cleanup, Robert M. Love <rml@tech9.net>
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/audit.h>
> #include <linux/capability.h>
> #include <linux/mm.h>
> @@ -42,15 +44,10 @@ __setup("no_file_caps", file_caps_disable);
>
> static void warn_legacy_capability_use(void)
> {
> - static int warned;
> - if (!warned) {
> - char name[sizeof(current->comm)];
> -
> - printk(KERN_INFO "warning: `%s' uses 32-bit capabilities"
> - " (legacy support in use)\n",
> - get_task_comm(name, current));
> - warned = 1;
> - }
> + char name[sizeof(current->comm)];
> +
> + pr_info_once("warning: `%s' uses 32-bit capabilities (legacy support in use)\n",
> + get_task_comm(name, current));
> }
>
> /*
> @@ -71,16 +68,10 @@ static void warn_legacy_capability_use(void)
>
> static void warn_deprecated_v2(void)
> {
> - static int warned;
> + char name[sizeof(current->comm)];
>
> - if (!warned) {
> - char name[sizeof(current->comm)];
> -
> - printk(KERN_INFO "warning: `%s' uses deprecated v2"
> - " capabilities in a way that may be insecure.\n",
> - get_task_comm(name, current));
> - warned = 1;
> - }
> + pr_info_once("warning: `%s' uses deprecated v2 capabilities in a way that may be insecure\n",
> + get_task_comm(name, current));
> }
>
> /*
> @@ -380,7 +371,7 @@ bool has_capability_noaudit(struct task_struct *t, int cap)
> bool ns_capable(struct user_namespace *ns, int cap)
> {
> if (unlikely(!cap_valid(cap))) {
> - printk(KERN_CRIT "capable() called with invalid cap=%u\n", cap);
> + pr_crit("capable() called with invalid cap=%u\n", cap);
> BUG();
> }
>
>
>
next prev parent reply other threads:[~2014-02-21 22:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 22:19 Joe Perches
2014-02-21 22:48 ` Serge Hallyn [this message]
2014-02-24 3:45 ` James Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140221224810.GA24302@sergelap \
--to=serge.hallyn@ubuntu.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge.hallyn@canonical.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®