From: Steffen Klassert <steffen.klassert@secunet.com>
To: Paul Moore <paul.moore@hp.com>
Cc: James Morris <jmorris@namei.org>, Eric Paris <eparis@redhat.com>,
linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov
Subject: [PATCH 4/4 v2] selinux: xfrm - notify users on dropped packets
Date: Thu, 24 Feb 2011 09:22:52 +0100 [thread overview]
Message-ID: <20110224082252.GP20852@secunet.com> (raw)
In-Reply-To: <201102230956.53069.paul.moore@hp.com>
In selinux_xfrm_state_pol_flow_match we have cases where we drop
packets without asking the avc. No audit message is generated in
this case. Lets at least print out a message to the logs, so the
users don't need to dig in the code to find out why these packets
are dropped.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
security/selinux/xfrm.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index 728c57e..b0dd401 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -118,25 +118,33 @@ int selinux_xfrm_state_pol_flow_match(struct xfrm_state *x, struct xfrm_policy *
int rc;
if (!xp->security)
- if (x->security)
- /* unlabeled policy and labeled SA can't match */
+ if (x->security) {
+ if (net_ratelimit())
+ printk("selinux: unlabeled policy and labeled SA can't match\n");
return 0;
- else
+ } else
/* unlabeled policy and unlabeled SA match all flows */
return 1;
else
- if (!x->security)
- /* unlabeled SA and labeled policy can't match */
+ if (!x->security) {
+ if (net_ratelimit())
+ printk("selinux: unlabeled SA and labeled policy can't match\n");
return 0;
- else
- if (!selinux_authorizable_xfrm(x))
- /* Not a SELinux-labeled SA */
+ } else {
+ if (!selinux_authorizable_xfrm(x)) {
+ if (net_ratelimit())
+ printk("selinux: Not a SELinux-labeled SA\n");
return 0;
+ }
+ }
state_sid = x->security->ctx_sid;
- if (fl->secid != state_sid)
+ if (fl->secid != state_sid) {
+ if (net_ratelimit())
+ printk("selinux: Flow label does not match SA label\n");
return 0;
+ }
rc = avc_has_perm(fl->secid, state_sid, SECCLASS_ASSOCIATION,
ASSOCIATION__SENDTO,
--
1.7.0.4
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next prev parent reply other threads:[~2011-02-24 8:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20110223115343.GH20852@secunet.com>
[not found] ` <20110223115715.GL20852@secunet.com>
2011-02-23 14:56 ` [PATCH 4/4] selinux: xfrm - notify users on dropped packets Paul Moore
2011-02-24 7:33 ` Steffen Klassert
2011-02-24 8:22 ` Steffen Klassert [this message]
2011-02-24 14:51 ` [PATCH 4/4 v2] " Eric Paris
2011-02-25 9:56 ` Steffen Klassert
2011-02-25 20:07 ` Eric Paris
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=20110224082252.GP20852@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=eparis@redhat.com \
--cc=jmorris@namei.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul.moore@hp.com \
--cc=selinux@tycho.nsa.gov \
/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 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.