From: Paul Moore <paul.moore@hp.com>
To: Venkat Yekkirala <vyekkirala@TrustedCS.com>
Cc: netdev@vger.kernel.org, selinux@tycho.nsa.gov, jmorris@namei.org,
sds@tycho.nsa.gov
Subject: Re: [PATCH 3/3] mlsxfrm: Various fixes
Date: Tue, 07 Nov 2006 15:29:24 -0500 [thread overview]
Message-ID: <4550ECA4.70909@hp.com> (raw)
In-Reply-To: <4550BF9A.3040002@trustedcs.com>
Venkat Yekkirala wrote:
> +/*
> + * security_sid_compare() - compares two given sid contexts.
> + * Returns 1 if they are equal, 0 otherwise.
> + */
> +int security_sid_compare(u32 sid1, u32 sid2)
> +{
> + struct context *context1;
> + struct context *context2;
> + int rc;
> +
> + if (!ss_initialized)
> + return 1;
> +
> + if (sid1 == sid2)
> + return 1;
> + else if (sid1 > SECINITSID_NUM && sid2 > SECINITSID_NUM)
> + return 0;
> +
> + /* explicit comparison in order */
> +
> + POLICY_RDLOCK;
> + context1 = sidtab_search(&sidtab, sid1);
> + if (!context1) {
> + printk(KERN_ERR "security_sid_compare: unrecognized SID "
> + "%u\n", sid1);
> + rc = 0;
> + goto out_unlock;
> + }
> +
> + context2 = sidtab_search(&sidtab, sid2);
> + if (!context2) {
> + printk(KERN_ERR "security_sid_compare: unrecognized SID "
> + "%u\n", sid2);
> + rc = 0;
> + goto out_unlock;
> + }
> +
> + rc = context_cmp(context1, context2);
> +
> +out_unlock:
> + POLICY_RDUNLOCK;
> + return rc;
> +}
I understand wanting a generic LSM interface to do secid token comparisons, but
in the SELinux implementation of this function I think we can get away with only
a simple "sid1 == sid2" since the security server shouldn't be creating
duplicate SID/secid values for identical contexts, I think. Did you run into
something in testing that would indicate otherwise?
--
paul moore
linux security @ hp
next prev parent reply other threads:[~2006-11-07 20:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-07 17:17 [PATCH 3/3] mlsxfrm: Various fixes Venkat Yekkirala
2006-11-07 20:29 ` Paul Moore [this message]
2006-11-07 20:48 ` Stephen Smalley
2006-11-08 14:34 ` Venkat Yekkirala
2006-11-08 17:34 ` Stephen Smalley
2006-11-08 19:17 ` Venkat Yekkirala
2006-11-08 21:57 ` Stephen Smalley
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=4550ECA4.70909@hp.com \
--to=paul.moore@hp.com \
--cc=jmorris@namei.org \
--cc=netdev@vger.kernel.org \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
--cc=vyekkirala@TrustedCS.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).