summaryrefslogtreecommitdiff
path: root/security/apparmor/include/lib.h
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2017-01-16 11:42:27 +0300
committerJohn Johansen <john.johansen@canonical.com>2017-01-16 12:18:24 +0300
commit680cd62e910d7b7e3c1fcde6ba67c6ca770c2286 (patch)
tree76730905bf9676fefb5070d908a13085ebb32394 /security/apparmor/include/lib.h
parent57e36bbd67bd1509f550311b162be78cadfe887b (diff)
downloadlinux-680cd62e910d7b7e3c1fcde6ba67c6ca770c2286.tar.xz
apparmor: add debug assert AA_BUG and Kconfig to control debug info
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/include/lib.h')
-rw-r--r--security/apparmor/include/lib.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/security/apparmor/include/lib.h b/security/apparmor/include/lib.h
index 61dedd7333df..d507c73ac9b8 100644
--- a/security/apparmor/include/lib.h
+++ b/security/apparmor/include/lib.h
@@ -35,12 +35,24 @@
* which is not related to profile accesses.
*/
+#define DEBUG_ON (aa_g_debug)
+#define dbg_printk(__fmt, __args...) pr_debug(__fmt, ##__args)
#define AA_DEBUG(fmt, args...) \
do { \
- if (aa_g_debug) \
+ if (DEBUG_ON) \
pr_debug_ratelimited("AppArmor: " fmt, ##args); \
} while (0)
+#define AA_WARN(X) WARN((X), "APPARMOR WARN %s: %s\n", __func__, #X)
+
+#define AA_BUG(X, args...) AA_BUG_FMT((X), "" args)
+#ifdef CONFIG_SECURITY_APPARMOR_DEBUG_ASSERTS
+#define AA_BUG_FMT(X, fmt, args...) \
+ WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)
+#else
+#define AA_BUG_FMT(X, fmt, args...)
+#endif
+
#define AA_ERROR(fmt, args...) \
pr_err_ratelimited("AppArmor: " fmt, ##args)