netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Venkat Yekkirala" <vyekkirala@trustedcs.com>
To: "'Herbert Xu'" <herbert.xu@redhat.com>
Cc: "'James Morris'" <jmorris@namei.org>,
	"David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
	"Paul Moore" <paul.moore@hp.com>
Subject: RE: [IPSEC] flow: Cache negative results
Date: Wed, 10 Jan 2007 15:08:55 -0600	[thread overview]
Message-ID: <001601c734fb$89ed3b90$cc0a010a@tcssec.com> (raw)
In-Reply-To: <20070110204922.GA1652@gondor.apana.org.au>

> > Only, on a security policy denial (-ESRCH from the LSM hook), a 0
> > is returned by the resolver to signify no applicable policy since
> > a negative result is akin to no policy. And I see the "no policy"
> > case is already cached.
>
> I'm not talking about an xfrm policy lookup failure, that exists
> with or without SELinux. I'm talking about an error returned from
> security_xfrm_policy_lookup(), i.e., whether a policy can be used
> or not.

I was talking about this (the latter) as well. Currently, on a proper
"negative", -ESRCH is returned by security_xfrm_policy_lookup(), and
this comes back up as a 0 from resolver(), correctly indicating NO
applicable
xfrm policy (after taking security into account). But if
security_xfrm_policy_lookup()
were to return anything other than a zero or -ESRCH, such as -ENOMEM,
you will see it come back up as such (as -ENOMEM) from resolver(),
and in this case, it's neither a positive nor a negative, just an error.
Hence a full lookup would be in order, the next time round.

>  For that case, we only cache positive results currently.

Negatives are currently properly cached as NULL. Any errors
returned from resolver() are true errors, not negatives. Hence,
they needn't be cached.

Also, I would fix the other bug you had noted, by something like:

@@ -232,11 +232,7 @@ nocache:
                err = resolver(key, family, dir, &obj, &obj_ref);

                if (fle) {
-                       if (err) {
-                               /* Force security policy check on next
lookup */
-                               *head = fle->next;
-                               flow_entry_kill(cpu, fle);
-                       } else {
+                       if (!err) {
                                fle->genid = atomic_read(&flow_cache_genid);

                                if (fle->object)


I am planning to test and submit a patch to SELinux
to invoke flow_cache_flush() on policy reloads tomorrow.

I believe changes to labels on SPD rules are already
taken care of by checks involving flow_cache_genid.


  reply	other threads:[~2007-01-10 21:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10  7:22 [IPSEC] flow: Cache negative results Herbert Xu
2007-01-10  9:24 ` David Miller
2007-01-10 14:15 ` James Morris
2007-01-10 15:26   ` Venkat Yekkirala
2007-01-10 17:41   ` Venkat Yekkirala
2007-01-10 20:49     ` Herbert Xu
2007-01-10 21:08       ` Venkat Yekkirala [this message]
2007-01-10 23:27         ` Herbert Xu
2007-01-11  6:06           ` David Miller
2007-01-11 11:29             ` Herbert Xu
2007-01-10 16:11 ` Paul Moore
2007-01-10 23:27   ` Herbert Xu

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='001601c734fb$89ed3b90$cc0a010a@tcssec.com' \
    --to=vyekkirala@trustedcs.com \
    --cc=davem@davemloft.net \
    --cc=herbert.xu@redhat.com \
    --cc=jmorris@namei.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul.moore@hp.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).