* [PATCH] selinux: Print 'sclass' as string when unrecognized netlink message occurs
@ 2015-04-02 15:58 Marek Milkovic
2015-04-03 12:23 ` Stephen Smalley
2015-04-07 11:28 ` Paul Moore
0 siblings, 2 replies; 4+ messages in thread
From: Marek Milkovic @ 2015-04-02 15:58 UTC (permalink / raw)
To: selinux
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>
---
security/selinux/hooks.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 87a9156..d75f525 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4712,8 +4712,8 @@ 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;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selinux: Print 'sclass' as string when unrecognized netlink message occurs
2015-04-02 15:58 [PATCH] selinux: Print 'sclass' as string when unrecognized netlink message occurs Marek Milkovic
@ 2015-04-03 12:23 ` Stephen Smalley
2015-04-07 11:28 ` Paul Moore
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Smalley @ 2015-04-03 12:23 UTC (permalink / raw)
To: Marek Milkovic, selinux
On 04/02/2015 11:58 AM, Marek Milkovic wrote:
> 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>
> ---
> security/selinux/hooks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 87a9156..d75f525 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -4712,8 +4712,8 @@ 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;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selinux: Print 'sclass' as string when unrecognized netlink message occurs
2015-04-02 15:58 [PATCH] selinux: Print 'sclass' as string when unrecognized netlink message occurs Marek Milkovic
2015-04-03 12:23 ` Stephen Smalley
@ 2015-04-07 11:28 ` Paul Moore
2015-05-04 18:50 ` Paul Moore
1 sibling, 1 reply; 4+ messages in thread
From: Paul Moore @ 2015-04-07 11:28 UTC (permalink / raw)
To: Marek Milkovic; +Cc: selinux
On Thu, Apr 2, 2015 at 11:58 AM, Marek Milkovic <mmilkovi@redhat.com> wrote:
> 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>
> ---
> security/selinux/hooks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks Marek, this looks good. I'm adding this to the next queue for
after the merge window.
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 87a9156..d75f525 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -4712,8 +4712,8 @@ 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;
> }
> --
> 2.1.0
>
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selinux: Print 'sclass' as string when unrecognized netlink message occurs
2015-04-07 11:28 ` Paul Moore
@ 2015-05-04 18:50 ` Paul Moore
0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2015-05-04 18:50 UTC (permalink / raw)
To: Marek Milkovic; +Cc: selinux
On Tuesday, April 07, 2015 07:28:07 AM Paul Moore wrote:
> On Thu, Apr 2, 2015 at 11:58 AM, Marek Milkovic <mmilkovi@redhat.com> wrote:
> > 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>
> > ---
> >
> > security/selinux/hooks.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Thanks Marek, this looks good. I'm adding this to the next queue for
> after the merge window.
Merged into next with a minor reformat to fit the code into an 80-char wide
terminal.
> > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> > index 87a9156..d75f525 100644
> > --- a/security/selinux/hooks.c
> > +++ b/security/selinux/hooks.c
> > @@ -4712,8 +4712,8 @@ 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;
> >
> > }
> >
> > --
> > 2.1.0
> >
> > _______________________________________________
> > Selinux mailing list
> > Selinux@tycho.nsa.gov
> > To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> > To get help, send an email containing "help" to
> > Selinux-request@tycho.nsa.gov.
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-04 18:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-02 15:58 [PATCH] selinux: Print 'sclass' as string when unrecognized netlink message occurs Marek Milkovic
2015-04-03 12:23 ` Stephen Smalley
2015-04-07 11:28 ` Paul Moore
2015-05-04 18:50 ` Paul Moore
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.