[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.21.1710041713160.19339@namei.org>
Date: Wed, 4 Oct 2017 17:17:39 +1100 (AEDT)
From: James Morris <jmorris@...ei.org>
To: Casey Schaufler <casey@...aufler-ca.com>
cc: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>,
linux-kernel <linux-kernel@...r.kernel.org>,
Serge Hallyn <serge@...lyn.com>,
James Morris <james.l.morris@...cle.com>,
LSM List <linux-security-module@...r.kernel.org>,
Stephen Smalley <sds@...ho.nsa.gov>
Subject: Re: [PATCH] fix security_release_secctx seems broken
On Tue, 19 Sep 2017, Casey Schaufler wrote:
> Subject: [PATCH] fix security_release_secctx seems broken
>
> security_inode_getsecurity() provides the text string value
> of a security attribute. It does not provide a "secctx".
> The code in xattr_getsecurity() that calls security_inode_getsecurity()
> and then calls security_release_secctx() happened to work because
> SElinux and Smack treat the attribute and the secctx the same way.
> It fails for cap_inode_getsecurity(), because that module has no
> secctx that ever needs releasing. It turns out that Smack is the
> one that's doing things wrong by not allocating memory when instructed
> to do so by the "alloc" parameter.
>
> The fix is simple enough. Change the security_release_secctx() to
> kfree() because it isn't a secctx being returned by
> security_inode_getsecurity(). Change Smack to allocate the string when
> told to do so.
>
> Signed-off-by: Casey Schaufler <casey@...aufler-ca.com>
Looks good to me. I wonder why security_release_secctx was used in the
first place? (it arrived via commit 42492594)
Konstantin: how did you trigger this?
I plan to send this to Linus for -rc4 unless anyone has objections.
--
James Morris
<jmorris@...ei.org>
Powered by blists - more mailing lists