All of lore.kernel.org
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: jmorris@namei.org, linux-security-module@vger.kernel.org,
	selinux@tycho.nsa.gov, john.johansen@canonical.com,
	eparis@redhat.com, keescook@chromium.org,
	Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH v10] LSM: Multiple concurrent LSMs
Date: Tue, 11 Dec 2012 07:31:31 -0800	[thread overview]
Message-ID: <50C751D3.60409@schaufler-ca.com> (raw)
In-Reply-To: <201212112128.ADI26010.OQJVLOFSOFtHMF@I-love.SAKURA.ne.jp>

On 12/11/2012 4:28 AM, Tetsuo Handa wrote:
> Casey Schaufler wrote:
>> The /proc/*/attr interfaces are given to one LSM. This
>> can be done by setting CONFIG_SECURITY_PRESENT.
> I don't like CONFIG_SECURITY_PRESENT.
>
>>  int security_getprocattr(struct task_struct *p, char *name, char **value)
>>  {
>> -	return security_ops->getprocattr(p, name, value);
>> +	if (lsm_present)
>> +		return present_getprocattr(p, name, value);
>> +	return -EINVAL;
>>  }
>>  
>> -int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
>> +int security_setprocattr(struct task_struct *p, char *name, void *value,
>> +				size_t size)
>>  {
>> -	return security_ops->setprocattr(p, name, value, size);
>> +	if (lsm_present)
>> +		return present_setprocattr(p, name, value, size);
>> +	return -EINVAL;
>>  }
> is what I meant but
>
>> +	/*
>> +	 * Use the LSM specified by CONFIG_SECURITY_PRESENT for
>> +	 * [gs]etprocattr. If the LSM specified is PRESENT_FIRST
>> +	 * use the first LSM to register that has the hooks.
>> +	 * If the specified LSM lacks the hooks treat it as if
>> +	 * there is no LSM registered that supplied them.
>> +	 */
>> +	if (ops->getprocattr && ops->setprocattr &&
>> +	    (!strcmp(ops->name, present_lsm) ||
>> +	     (!lsm_present && !strcmp(PRESENT_FIRST, present_lsm)))) {
>> +		lsm_present = ops;
>> +		present_getprocattr = ops->getprocattr;
>> +		present_setprocattr = ops->setprocattr;
>> +		pr_info("Security Module %s is presented in /proc.\n",
>> +			ops->name);
>> +	}
> is not what I meant.
>
> CONFIG_SECURITY_PRESENT must be always PRESENT_FIRST and only one LSM module
> which provides ops->getprocattr and/or ops->setprocattr is allowed to register.

No.
Absolutely not.

That restriction would make composing security modules completely
useless. At least for me. Sorry, but Smack + AppArmor is one of my
success criteria. I have introduced a smackfs/current interface
in this patch, but I plan to abandon that in favor of the enhanced
proc/.../attr entries we've been discussing.

I have not given up hope on secid using LSM combinations, either.
I really would prefer that there be no limitations.


> This is a mandatory requirement for not to break userspace tools for
> non-present LSM modules by supplying /proc/pid/attr/ interface that is
> malfunction for non-present LSM modules.
>
> 	/*
> 	 * Check for conflicting LSMs.
> 	 */
> #ifdef CONFIG_SECURITY_NETWORK_XFRM
> 	if (ops->xfrm_policy_alloc_security &&
> 	    !list_empty(&lsm_hooks[LSM_xfrm_policy_alloc_security])) {
> 		pr_warn("LSM conflict on %s. %s not loaded.\n",
> 				"xfrm_policy_alloc_security", ops->name);
> 		return 0;
> 	}
> #endif
> 	if (ops->secid_to_secctx &&
> 	    !list_empty(&lsm_hooks[LSM_secid_to_secctx])) {
> 		pr_warn("LSM conflict on %s. %s not loaded.\n",
> 			"secid_to_secctx", ops->name);
> 		return 0;
> 	}
> 	if ((ops->getprocattr && !list_empty(&lsm_hooks[LSM_getprocattr])) ||
> 	    (ops->setprocattr && !list_empty(&lsm_hooks[LSM_setprocattr]))) {
> 		pr_warn("LSM conflict on %s. %s not loaded.\n",
> 			"getprocattr/setprocattr", ops->name);
> 		return 0;
> 	}
>


--
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.

       reply	other threads:[~2012-12-11 15:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <50C65DE2.5090909@schaufler-ca.com>
     [not found] ` <201212112128.ADI26010.OQJVLOFSOFtHMF@I-love.SAKURA.ne.jp>
2012-12-11 15:31   ` Casey Schaufler [this message]
     [not found]     ` <201212122159.CEC09839.HMOFtQFLJSVFOO@I-love.SAKURA.ne.jp>
2012-12-12 15:48       ` [PATCH v10] LSM: Multiple concurrent LSMs Casey Schaufler
2012-12-12 15:55         ` Eric Paris
2012-12-12 16:24           ` Casey Schaufler
2012-12-12 16:33             ` Eric Paris
2012-12-12 17:04               ` Casey Schaufler
2012-12-12 17:11                 ` Eric Paris
     [not found]                   ` <CAGXu5jLf+apZK5poD6GKzLkC+p6+mAqKhU3neoOZjr2JumvmpA@mail.gmail.com>
2012-12-12 17:22                     ` Eric Paris
2012-12-12 17:31                   ` Casey Schaufler
2012-12-12 17:47                     ` Eric Paris
2012-12-12 18:25                       ` Casey Schaufler
2012-12-12 18:47                         ` Eric Paris
2012-12-12 20:46                           ` Casey Schaufler
2012-12-12 20:51                             ` Eric Paris
2012-12-12 22:01                               ` Casey Schaufler
     [not found]                 ` <201212132106.AFI82338.QMFHFLSJOtOOFV@I-love.SAKURA.ne.jp>
2012-12-13 16:12                   ` Eric Paris
2012-12-13 16:31                     ` Casey Schaufler
     [not found]                       ` <CAGXu5jJf4NEvs6TjVCBxgd9e8cGwag_-viEntgTBUq85fULr8w@mail.gmail.com>
2012-12-16  3:06                         ` Casey Schaufler
     [not found]                     ` <201212142326.DDG90674.SFHFMOOVLFJtQO@I-love.SAKURA.ne.jp>
2012-12-14 15:07                       ` Eric Paris
2012-12-13 16:38                   ` 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=50C751D3.60409@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-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 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.