Skip to content

Commit

Permalink
selinux: Print 'sclass' as string when unrecognized netlink message o…
Browse files Browse the repository at this point in the history
…ccurs

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 <[email protected]>
Acked-by: Stephen Smalley <[email protected]>
[PM: 80-char width fixes]
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
Marek Milkovic authored and pcmoore committed Jun 4, 2015
1 parent e6e29a4 commit cded3ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -4713,8 +4713,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;
}
Expand Down

0 comments on commit cded3ff

Please sign in to comment.