From: Casey Schaufler <casey@schaufler-ca.com>
To: Kees Cook <keescook@chromium.org>
Cc: LKLM <linux-kernel@vger.kernel.org>,
LSM <linux-security-module@vger.kernel.org>,
SE Linux <selinux@tycho.nsa.gov>,
James Morris <jmorris@namei.org>,
John Johansen <john.johansen@canonical.com>,
Eric Paris <eparis@redhat.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH v14 3/6] LSM: Explicit individual LSM associations
Date: Mon, 29 Jul 2013 18:48:21 -0700 [thread overview]
Message-ID: <51F71B65.5060205@schaufler-ca.com> (raw)
In-Reply-To: <CAGXu5jLEd8vt0d7aEecP7BMCduTyeFs56wv07TCCXbRr001B+Q@mail.gmail.com>
On 7/29/2013 1:51 PM, Kees Cook wrote:
> On Thu, Jul 25, 2013 at 11:32 AM, Casey Schaufler
> <casey@schaufler-ca.com> wrote:
>> Subject: [PATCH v14 3/6] LSM: Explicit individual LSM associations
>> [...]
>> Introduce feature specific security operation vectors
>> for NetLabel, XFRM, secmark and presentation in the
>> traditional /proc/.../attr interfaces. This allows
>> proper handling of secids.
>> [...]
>> --- a/include/linux/lsm.h
>> +++ b/include/linux/lsm.h
>> @@ -164,9 +164,18 @@ static inline void lsm_init_secid(struct secids *secid, u32 lsecid, int order)
>> {
>> memset(secid, 0, sizeof(*secid));
>>
>> - if (lsecid != 0)
>> + if (lsecid == 0)
>> + return;
>> + /*
>> + * An order of -1 means set it for all LSMs.
>> + */
>> + if (order < 0) {
>> + secid->si_lsm[0] = lsecid;
>> + secid->si_count++;
>> + } else {
>> + secid->si_lsm[order] = lsecid;
>> secid->si_count = 1;
>> - secid->si_lsm[order] = lsecid;
>> + }
>> }
>>
>> static inline int lsm_zero_secid(struct secids *secid)
>> @@ -178,39 +187,64 @@ static inline int lsm_zero_secid(struct secids *secid)
>>
>> #ifdef CONFIG_SECURITY
>>
>> +extern struct security_operations *present_ops;
>> static inline struct security_operations *lsm_present_ops(void)
>> {
>> - return security_ops;
>> + return present_ops;
>> }
>>
>> static inline int lsm_present_order(void)
>> {
>> - return 0;
>> + return present_ops->order;
>> }
>>
>> +#ifdef CONFIG_NETLABEL
>> +extern struct security_operations *netlbl_ops;
>> +
>> static inline struct security_operations *lsm_netlbl_ops(void)
>> {
>> - return security_ops;
>> + return netlbl_ops;
>> }
>>
>> static inline int lsm_netlbl_order(void)
>> {
>> - return 0;
>> + return netlbl_ops->order;
>> }
>> +#endif /* CONFIG_NETLABEL */
>> +
>> +#ifdef CONFIG_SECURITY_NETWORK_XFRM
>> +extern struct security_operations *xfrm_ops;
>>
>> static inline struct security_operations *lsm_xfrm_ops(void)
>> {
>> - return security_ops;
>> + return xfrm_ops;
>> }
>>
>> static inline int lsm_xfrm_order(void)
>> {
>> - return 0;
>> + return xfrm_ops->order;
>> }
>> +#endif /* CONFIG_SECURITY_NETWORK_XFRM */
>> +
>> +#ifdef CONFIG_NETWORK_SECMARK
>> +extern struct security_operations *secmark_ops;
>>
>> static inline struct security_operations *lsm_secmark_ops(void)
>> {
>> - return security_ops;
>> + return secmark_ops;
>> +}
>> +
>> +static inline int lsm_secmark_order(void)
>> +{
>> + return secmark_ops->order;
>> +}
>> +#endif /* CONFIG_NETWORK_SECMARK */
>> +
>> +#else /* CONFIG_SECURITY */
>> +
>> +static inline int lsm_xfrm_order(void)
>> +{
>> + return 0;
>> }
>>
>> static inline int lsm_secmark_order(void)
>> @@ -218,6 +252,11 @@ static inline int lsm_secmark_order(void)
>> return 0;
>> }
>>
>> +static inline struct security_operations *lsm_secmark_ops(void)
>> +{
>> + return NULL;
>> +}
>> +
>> #endif /* CONFIG_SECURITY */
>>
>> #endif /* ! _LINUX_LSM_H */
> Something went wrong here with the #ifdef/#else stuff here. I built
> without CONFIG_SECURITY_NETWORK_XFRM and it fails, missing
> lsm_xfrm_order().
>
> If I added an #else to the CONFIG_SECURITY_NETWORK_XFRM check and made
> lsm_xfrm_order() return 0 there too, it built fine.
Yup, I missed that configuration iteration at the end.
I've incorporated a fix.
>
> -Kees
>
next prev parent reply other threads:[~2013-07-30 1:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 18:22 [PATCH v14 0/6] LSM: Multiple concurrent LSMs Casey Schaufler
2013-07-25 18:32 ` [PATCH v14 1/6] LSM: Security blob abstraction Casey Schaufler
2013-07-29 21:15 ` Kees Cook
2013-07-30 1:49 ` Casey Schaufler
2013-07-25 18:32 ` [PATCH v14 2/6] LSM: Move the capability LSM into the hook handlers Casey Schaufler
2013-07-25 18:32 ` [PATCH v14 3/6] LSM: Explicit individual LSM associations Casey Schaufler
2013-07-29 20:51 ` Kees Cook
2013-07-30 1:48 ` Casey Schaufler [this message]
2013-07-30 22:08 ` Paul Moore
2013-07-31 16:22 ` Casey Schaufler
2013-07-31 19:39 ` Paul Moore
2013-07-31 21:21 ` Casey Schaufler
2013-08-01 18:35 ` Paul Moore
2013-08-01 18:52 ` Casey Schaufler
2013-08-01 21:30 ` Paul Moore
2013-08-01 22:15 ` Casey Schaufler
2013-08-01 22:18 ` Paul Moore
2013-07-25 18:32 ` [PATCH v14 4/6] LSM: List based multiple LSM hooks Casey Schaufler
2013-07-25 18:32 ` [PATCH v14 5/6] LSM: SO_PEERSEC configuration options Casey Schaufler
2013-07-30 21:47 ` Paul Moore
2013-07-31 15:45 ` Casey Schaufler
2013-07-31 17:56 ` Paul Moore
2013-07-25 18:32 ` [PATCH v14 6/6] LSM: Multiple LSM Documentation and cleanup Casey Schaufler
2013-07-26 23:17 ` Randy Dunlap
2013-07-28 18:46 ` Casey Schaufler
2013-08-01 2:48 ` [PATCH v14 0/6] LSM: Multiple concurrent LSMs Balbir Singh
2013-08-01 17:21 ` Casey Schaufler
2013-08-06 3:28 ` Balbir Singh
2013-08-06 6:30 ` Kees Cook
2013-08-06 22:25 ` Casey Schaufler
2013-08-06 22:36 ` Kees Cook
2013-08-27 2:29 ` Casey Schaufler
2013-08-28 15:55 ` Kees Cook
2013-09-05 18:48 ` Kees Cook
2013-09-06 6:44 ` Casey Schaufler
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=51F71B65.5060205@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=eparis@redhat.com \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox