mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morris <jmorris@namei.org>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Serge Hallyn <serge@hallyn.com>,
	James Morris <james.l.morris@oracle.com>,
	LSM List <linux-security-module@vger.kernel.org>,
	Stephen Smalley <sds@tycho.nsa.gov>
Subject: Re: [PATCH] fix security_release_secctx seems broken
Date: Wed, 4 Oct 2017 17:17:39 +1100 (AEDT)	[thread overview]
Message-ID: <alpine.LRH.2.21.1710041713160.19339@namei.org> (raw)
In-Reply-To: <ec271e46-07d3-78ba-e58d-3606b0889cbf@schaufler-ca.com>

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@schaufler-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@namei.org>

  parent reply	other threads:[~2017-10-04  6:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-16 18:18 [BUG] " Konstantin Khlebnikov
2017-09-18 20:25 ` Casey Schaufler
2017-09-19  2:21   ` Casey Schaufler
2017-09-19 16:39   ` [PATCH] fix " Casey Schaufler
2017-09-20 11:48     ` Konstantin Khlebnikov
2017-10-04  6:17     ` James Morris [this message]
2017-10-04  9:29       ` Konstantin Khlebnikov
2017-10-04 22:10         ` James Morris

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=alpine.LRH.2.21.1710041713160.19339@namei.org \
    --to=jmorris@namei.org \
    --cc=casey@schaufler-ca.com \
    --cc=james.l.morris@oracle.com \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=serge@hallyn.com \
    /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

all inboxes | Powered by JetHome®