From: Joe Perches <joe@perches.com>
To: linux-kernel@vger.kernel.org
Cc: Serge Hallyn <serge.hallyn@canonical.com>,
James Morris <james.l.morris@oracle.com>,
linux-security-module@vger.kernel.org
Subject: [PATCH V2 1/8] security: Use a more current logging style
Date: Tue, 25 Feb 2014 11:41:07 -0800 [thread overview]
Message-ID: <d7dea4f17b5d69997f5c8666e7594dbe845e883e.1393357067.git.joe@perches.com> (raw)
In-Reply-To: <20140225191003.GB22246@sergelap>
Convert printks to pr_<level>.
Convert printk with single time guard to pr_info_once.
Add pr_fmt to prefix output with "security: " or "capability: "
Coalesce formats.
Use a generic string for pr_debug to reduce object size.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Reported-by: Serge Hallyn <serge.hallyn@ubuntu.com> (pr_info_once)
---
security/capability.c | 16 +++++++++-------
security/commoncap.c | 19 ++++++++-----------
security/security.c | 4 +++-
3 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/security/capability.c b/security/capability.c
index 8b4f24a..086af9b 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -10,6 +10,8 @@
*
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/security.h>
static int cap_syslog(int type)
@@ -914,13 +916,13 @@ static void cap_audit_rule_free(void *lsmrule)
#endif /* CONFIG_AUDIT */
#define set_to_cap_if_null(ops, function) \
- do { \
- if (!ops->function) { \
- ops->function = cap_##function; \
- pr_debug("Had to override the " #function \
- " security operation with the default.\n");\
- } \
- } while (0)
+do { \
+ if (!ops->function) { \
+ ops->function = cap_##function; \
+ pr_debug("Had to override the %s security operation with the default\n", \
+ #function); \
+ } \
+} while (0)
void __init security_fixup_ops(struct security_operations *ops)
{
diff --git a/security/commoncap.c b/security/commoncap.c
index b9d613e..09da086 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -7,6 +7,8 @@
*
*/
+#define pr_fmt(fmt) "capability: " fmt
+
#include <linux/capability.h>
#include <linux/audit.h>
#include <linux/module.h>
@@ -44,13 +46,8 @@
*/
static void warn_setuid_and_fcaps_mixed(const char *fname)
{
- static int warned;
- if (!warned) {
- printk(KERN_INFO "warning: `%s' has both setuid-root and"
- " effective capabilities. Therefore not raising all"
- " capabilities.\n", fname);
- warned = 1;
- }
+ pr_info_once("warning: `%s' has both setuid-root and effective capabilities, therefore not raising all capabilities\n",
+ fname);
}
int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
@@ -448,8 +445,8 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c
rc = get_vfs_caps_from_disk(dentry, &vcaps);
if (rc < 0) {
if (rc == -EINVAL)
- printk(KERN_NOTICE "%s: get_vfs_caps_from_disk returned %d for %s\n",
- __func__, rc, bprm->filename);
+ pr_notice("%s: get_vfs_caps_from_disk returned %d for %s\n",
+ __func__, rc, bprm->filename);
else if (rc == -ENODATA)
rc = 0;
goto out;
@@ -457,8 +454,8 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c
rc = bprm_caps_from_vfs_caps(&vcaps, bprm, effective, has_cap);
if (rc == -EINVAL)
- printk(KERN_NOTICE "%s: cap_from_disk returned %d for %s\n",
- __func__, rc, bprm->filename);
+ pr_notice("%s: cap_from_disk returned %d for %s\n",
+ __func__, rc, bprm->filename);
out:
dput(dentry);
diff --git a/security/security.c b/security/security.c
index 15b6928..53d1885 100644
--- a/security/security.c
+++ b/security/security.c
@@ -11,6 +11,8 @@
* (at your option) any later version.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/capability.h>
#include <linux/dcache.h>
#include <linux/module.h>
@@ -64,7 +66,7 @@ static void __init do_security_initcalls(void)
*/
int __init security_init(void)
{
- printk(KERN_INFO "Security Framework initialized\n");
+ pr_info("Security Framework initialized\n");
security_fixup_ops(&default_security_ops);
security_ops = &default_security_ops;
--
1.8.1.2.459.gbcd45b4.dirty
next prev parent reply other threads:[~2014-02-25 19:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-24 21:59 [PATCH 0/8] " Joe Perches
2014-02-24 21:59 ` [PATCH 1/8] " Joe Perches
2014-02-25 19:10 ` Serge Hallyn
2014-02-25 19:34 ` Joe Perches
2014-02-25 19:41 ` Joe Perches [this message]
2014-02-24 21:59 ` [PATCH 2/8] security: apparmor: " Joe Perches
2014-02-26 7:31 ` John Johansen
2014-02-26 14:43 ` Joe Perches
2014-02-24 21:59 ` [PATCH 3/8] security: integrity: " Joe Perches
2014-02-25 2:59 ` Mimi Zohar
2014-02-24 21:59 ` [PATCH 4/8] security: keys: " Joe Perches
2014-02-24 21:59 ` [PATCH 5/8] security: selinux: " Joe Perches
2014-02-25 20:05 ` Paul Moore
2014-02-25 20:20 ` Joe Perches
2014-02-24 21:59 ` [PATCH 6/8] security: smack: " Joe Perches
2014-02-24 22:16 ` Casey Schaufler
2014-02-24 22:23 ` Joe Perches
2014-02-24 22:33 ` Casey Schaufler
2014-02-24 22:35 ` Casey Schaufler
2014-02-24 23:01 ` Casey Schaufler
2014-02-25 7:47 ` James Morris
[not found] ` <17D2BA68-5581-4326-B6DD-5EC959235B71@aol.com>
2014-02-26 0:56 ` Joe Perches
2014-02-24 22:00 ` [PATCH 7/8] security: tomoyo: " Joe Perches
2014-02-25 12:58 ` Tetsuo Handa
2014-02-24 22:00 ` [PATCH 8/8] security: yama: " Joe Perches
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=d7dea4f17b5d69997f5c8666e7594dbe845e883e.1393357067.git.joe@perches.com \
--to=joe@perches.com \
--cc=james.l.morris@oracle.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®