summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Milkovic <mmilkovi@redhat.com>2015-06-04 16:22:16 -0400
committerBen Hutchings <ben@decadent.org.uk>2020-06-11 19:05:39 +0100
commitb122516be7a9cccceb48dc7ee6ff1717b39e6ae2 (patch)
tree46f83be7acb1252cae460532f7b5f2ee263f8b39
parent68c46f7a2891110c582a94a807018d231e81eefe (diff)
downloadlinux-stable-b122516be7a9cccceb48dc7ee6ff1717b39e6ae2.tar.gz
linux-stable-b122516be7a9cccceb48dc7ee6ff1717b39e6ae2.tar.bz2
linux-stable-b122516be7a9cccceb48dc7ee6ff1717b39e6ae2.zip
selinux: Print 'sclass' as string when unrecognized netlink message occurs
commit cded3fffbeab777e6ad2ec05d4a3b62c5caca0f3 upstream. This prints the 'sclass' field as string instead of index in unrecognized netlink message. The textual representation makes it easier to distinguish the right class. Signed-off-by: Marek Milkovic <mmilkovi@redhat.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> [PM: 80-char width fixes] Signed-off-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--security/selinux/hooks.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index ba090b1ae8eb..99814b6807c4 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4685,8 +4685,9 @@ static int selinux_nlmsg_perm(struct sock *sk, struct sk_buff *skb)
if (err == -EINVAL) {
printk(KERN_WARNING
"SELinux: unrecognized netlink message:"
- " protocol=%hu nlmsg_type=%hu sclass=%hu\n",
- sk->sk_protocol, nlh->nlmsg_type, sksec->sclass);
+ " protocol=%hu nlmsg_type=%hu sclass=%s\n",
+ sk->sk_protocol, nlh->nlmsg_type,
+ secclass_map[sksec->sclass - 1].name);
if (!selinux_enforcing || security_get_allow_unknown())
err = 0;
}