[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4DB8AAFA.2050903@schaufler-ca.com>
Date: Wed, 27 Apr 2011 16:47:06 -0700
From: Casey Schaufler <casey@...aufler-ca.com>
To: Roberto Sassu <roberto.sassu@...ito.it>
CC: linux-security-module@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
dhowells@...hat.com, jmorris@...ei.org, zohar@...ux.vnet.ibm.com,
safford@...son.ibm.com, tyhicks@...ux.vnet.ibm.com,
kirkland@...onical.com, ecryptfs-devel@...ts.launchpad.net,
eparis@...hat.com, sds@...ho.nsa.gov, selinux@...ho.nsa.gov,
viro@...iv.linux.org.uk, Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [RFC][PATCH 5/7] smack: import the security label in smack_secctx_to_secid()
On 4/27/2011 5:34 AM, Roberto Sassu wrote:
> The security label passed as argument in smack_secctx_to_secid() must be
> first imported in the 'smack_known_list' list before finding the security
> identifier associated to it. This allows the function
> set_security_override_from_ctx() to be performed successfully even if the
> label is not yet present in the smack list.
>
> Signed-off-by: Roberto Sassu <roberto.sassu@...ito.it>
Nacked-by: Casey Schaufler <casey@...aufler-ca.com>
security_secctx_to_secid() is called from the netlabel code
and hence cannot (to my understanding) allocate memory,
which is something that smk_import will do if the label is
new. I am willing to be convinced that doing so is safe,
but my understanding is that it is not.
> ---
> security/smack/smack_lsm.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 0e7ed31..6612ba1 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -3346,7 +3346,13 @@ static int smack_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
> */
> static int smack_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid)
> {
> - *secid = smack_to_secid(secdata);
> + char *smack;
> +
> + smack = smk_import(secdata, seclen);
> + if (smack == NULL)
> + return -EINVAL;
> +
> + *secid = smack_to_secid(smack);
> return 0;
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists