From: Casey Schaufler <casey@schaufler-ca.com>
To: Etienne Basset <etienne.basset@numericable.fr>
Cc: LSM <linux-security-module@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Smack: check for SMACK xattr validity in smack_inode_setxattr
Date: Thu, 16 Apr 2009 20:48:19 -0700 [thread overview]
Message-ID: <49E7FC03.20605@schaufler-ca.com> (raw)
In-Reply-To: <49E7AA12.2090406@numericable.fr>
Etienne Basset wrote:
> the following patch moves checks for SMACK xattr validity
> from smack_inode_post_setxattr (which cannot return an error to the user)
> to smack_inode_setxattr (which can return an error).
>
> Signed-off-by: Etienne Basset <etienne.basset@numericable.fr>
>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
> ---
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 9215149..98b3195 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -609,8 +609,12 @@ static int smack_inode_setxattr(struct dentry *dentry, const char *name,
> strcmp(name, XATTR_NAME_SMACKIPOUT) == 0) {
> if (!capable(CAP_MAC_ADMIN))
> rc = -EPERM;
> - /* a label cannot be void and cannot begin with '-' */
> - if (size == 0 || (size > 0 && ((char *)value)[0] == '-'))
> + /*
> + * check label validity here so import wont fail on
> + * post_setxattr
> + */
> + if (size == 0 || size >= SMK_LABELLEN ||
> + smk_import(value, size) == NULL)
> rc = -EINVAL;
> } else
> rc = cap_inode_setxattr(dentry, name, value, size, flags);
> @@ -644,9 +648,6 @@ static void smack_inode_post_setxattr(struct dentry *dentry, const char *name,
> if (strcmp(name, XATTR_NAME_SMACK))
> return;
>
> - if (size >= SMK_LABELLEN)
> - return;
> -
> isp = dentry->d_inode->i_security;
>
> /*
>
>
>
>
prev parent reply other threads:[~2009-04-17 3:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-14 18:28 [PATCH] Smack: check for SMACK xattr max size in smack_inode_setxattr Etienne Basset
2009-04-15 4:25 ` Casey Schaufler
2009-04-15 6:26 ` Etienne Basset
2009-04-15 16:28 ` Casey Schaufler
2009-04-16 21:58 ` [PATCH] Smack: check for SMACK xattr validity " Etienne Basset
2009-04-17 3:48 ` Casey Schaufler [this message]
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=49E7FC03.20605@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=etienne.basset@numericable.fr \
--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 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.