linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: LSM <linux-security-module@vger.kernel.org>,
	LKLM <linux-kernel@vger.kernel.org>,
	James Morris <jmorris@namei.org>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] LSM: Add a Smack subdirectory in /proc/.../attr
Date: Thu, 19 Jan 2017 02:52:07 +0300	[thread overview]
Message-ID: <20170118235207.GA17613@avx2> (raw)
In-Reply-To: <b7abb223-4211-adb4-c2fa-39d895cda1bc@schaufler-ca.com>

On Wed, Jan 18, 2017 at 11:07:19AM -0800, Casey Schaufler wrote:

> -int security_getprocattr(struct task_struct *p, char *name, char **value)
> +int security_getprocattr(struct task_struct *p, const char *lsm, char *name,
> +				char **value)
>  {
> -	return call_int_hook(getprocattr, -EINVAL, p, name, value);
> +	struct security_hook_list *hp;
> +	int rc = -EINVAL;

This is dead write.

> +	list_for_each_entry(hp, &security_hook_heads.getprocattr, list) {
> +		if (lsm != NULL && strcmp(lsm, hp->lsm))
> +			continue;
> +		rc = hp->hook.getprocattr(p, name, value);
> +		if (rc != -ENOENT)
> +			return rc;
> +	}
> +	return -EINVAL;		<-------+
					|
> -int security_setprocattr(struct task_|struct *p, char *name, void *value, size_t size)
> +int security_setprocattr(struct task_|struct *p, const char *lsm, char *name,
> +				void *va|lue, size_t size)
>  {					|
> -	return call_int_hook(setprocattr|, -EINVAL, p, name, value, size);
> +	struct security_hook_list *hp;	|
> +	int rc = -EINVAL;		|
					|
This one is not.			|
					|
> +					|
> +	list_for_each_entry(hp, &securit|y_hook_heads.setprocattr, list) {
> +		if (lsm != NULL && strcm|p(lsm, hp->lsm))
> +			continue;	|
> +		rc = hp->hook.setprocatt|r(p, name, value, size);
> +		if (rc != -ENOENT)	|
> +			break;		|
> +	}				|
> +	return rc;		<-------+

  reply	other threads:[~2017-01-18 21:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 19:07 [PATCH] LSM: Add a Smack subdirectory in /proc/.../attr Casey Schaufler
2017-01-18 23:52 ` Alexey Dobriyan [this message]
2017-01-18 22:16   ` 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=20170118235207.GA17613@avx2 \
    --to=adobriyan@gmail.com \
    --cc=casey@schaufler-ca.com \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /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).