All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: Matthew Garrett <mjg59@google.com>
Cc: linux-integrity <linux-integrity@vger.kernel.org>,
	Paul Moore <paul@paul-moore.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	Eric Paris <eparis@parisplace.org>,
	selinux@tycho.nsa.gov, Casey Schaufler <casey@schaufler-ca.com>,
	LSM List <linux-security-module@vger.kernel.org>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Subject: Re: [PATCH V3 2/2] IMA: Support using new creds in appraisal policy
Date: Tue, 28 Nov 2017 17:33:10 -0500	[thread overview]
Message-ID: <1511908390.3473.30.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <CACdnJuvN6NxHLG=hS4iDRHBGWWdzFeUMfkF3ETRjXCbwiXpgnQ@mail.gmail.com>

On Tue, 2017-11-28 at 13:37 -0800, Matthew Garrett wrote:
> On Tue, Nov 28, 2017 at 1:35 PM, Mimi Zohar <zohar@linux.vnet.ibm.com> wrote:
> > On Tue, 2017-11-28 at 13:22 -0800, Matthew Garrett wrote:
> >> We need to check against the appropriate credentials structure, and
> >> since we're doing this before commit_creds() has been called we can't
> >> just do it against the one in the task structure.  For BPRM_CHECK
> >> that'll be current_cred(), which means there's no change in
> >> functionality, whereas for CREDS_CHECK it'll be the new credentials
> >> structure.
> >
> > The existing code calls security_task_getsecid() with "current" not
> > "current_cred".  Will replacing security_task_getsecid() with
> > security_cred_getsecid() return the same info for the original
> > BRPM_CHECK?
> 
> security_task_getsecid(current) will give the same results as
> security_cred_getsecid(current_creds())

Unwinding security_task_getsecid(current) looks like it is using
real_cred, while current_cred() is using cred.

selinux_task_getsecid() -> task_sid() -> cred_sid(__task_cred())

#define __task_cred(task)       \
        rcu_dereference((task)->real_cred)

selinux_task_getsecid() -> cred_sid()

#define current_cred() \
        rcu_dereference_protected(current->cred, 1)

Is the change intentional?

Mimi

WARNING: multiple messages have this Message-ID (diff)
From: zohar@linux.vnet.ibm.com (Mimi Zohar)
To: linux-security-module@vger.kernel.org
Subject: [PATCH V3 2/2] IMA: Support using new creds in appraisal policy
Date: Tue, 28 Nov 2017 17:33:10 -0500	[thread overview]
Message-ID: <1511908390.3473.30.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <CACdnJuvN6NxHLG=hS4iDRHBGWWdzFeUMfkF3ETRjXCbwiXpgnQ@mail.gmail.com>

On Tue, 2017-11-28 at 13:37 -0800, Matthew Garrett wrote:
> On Tue, Nov 28, 2017 at 1:35 PM, Mimi Zohar <zohar@linux.vnet.ibm.com> wrote:
> > On Tue, 2017-11-28 at 13:22 -0800, Matthew Garrett wrote:
> >> We need to check against the appropriate credentials structure, and
> >> since we're doing this before commit_creds() has been called we can't
> >> just do it against the one in the task structure.  For BPRM_CHECK
> >> that'll be current_cred(), which means there's no change in
> >> functionality, whereas for CREDS_CHECK it'll be the new credentials
> >> structure.
> >
> > The existing code calls security_task_getsecid() with "current" not
> > "current_cred".  Will replacing security_task_getsecid() with
> > security_cred_getsecid() return the same info for the original
> > BRPM_CHECK?
> 
> security_task_getsecid(current) will give the same results as
> security_cred_getsecid(current_creds())

Unwinding security_task_getsecid(current) looks like it is using
real_cred, while current_cred() is using cred.

selinux_task_getsecid() -> task_sid() -> cred_sid(__task_cred())

#define __task_cred(task)       \
        rcu_dereference((task)->real_cred)

selinux_task_getsecid() -> cred_sid()

#define current_cred() \
        rcu_dereference_protected(current->cred, 1)

Is the change intentional?

Mimi

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-11-28 22:33 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26  8:40 [PATCH V3 1/2] security: Add a cred_getsecid hook Matthew Garrett
2017-10-26  8:40 ` Matthew Garrett
2017-10-26  8:40 ` [PATCH V3 2/2] IMA: Support using new creds in appraisal policy Matthew Garrett
2017-10-26  8:40   ` Matthew Garrett
2017-10-26  9:11   ` James Morris
2017-10-26  9:11     ` James Morris
2017-11-28 20:48   ` Mimi Zohar
2017-11-28 20:48     ` Mimi Zohar
2017-11-28 20:48     ` Mimi Zohar
2017-11-28 21:22     ` Matthew Garrett
2017-11-28 21:22       ` Matthew Garrett
2017-11-28 21:35       ` Mimi Zohar
2017-11-28 21:35         ` Mimi Zohar
2017-11-28 21:35         ` Mimi Zohar
2017-11-28 21:37         ` Matthew Garrett
2017-11-28 21:37           ` Matthew Garrett
2017-11-28 22:33           ` Mimi Zohar [this message]
2017-11-28 22:33             ` Mimi Zohar
2017-12-15 22:24             ` Matthew Garrett
2017-12-15 22:24               ` Matthew Garrett
2017-12-15 22:35               ` Matthew Garrett
2017-12-15 22:35                 ` Matthew Garrett
2017-12-18 15:39                 ` Mimi Zohar
2017-12-18 15:39                   ` Mimi Zohar
2017-12-18 15:39                   ` Mimi Zohar
2017-10-26  9:04 ` [PATCH V3 1/2] security: Add a cred_getsecid hook James Morris
2017-10-26  9:04   ` James Morris
2017-10-26 13:21 ` Casey Schaufler
2017-10-26 13:21   ` Casey Schaufler
2017-10-30 10:54   ` Matthew Garrett
2017-10-30 10:54     ` Matthew Garrett
2017-10-26 14:20 ` Stephen Smalley
2017-10-26 14:20   ` Stephen Smalley
2017-10-26 14:20   ` Stephen Smalley
2017-10-30 10:57   ` Matthew Garrett
2017-10-30 10:57     ` Matthew Garrett
2017-10-30 17:03     ` Stephen Smalley
2017-10-30 17:03       ` Stephen Smalley
2017-10-30 17:03       ` Stephen Smalley
2017-11-14 19:42       ` Matthew Garrett
2017-11-14 19:42         ` Matthew Garrett

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=1511908390.3473.30.camel@linux.vnet.ibm.com \
    --to=zohar@linux.vnet.ibm.com \
    --cc=casey@schaufler-ca.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=eparis@parisplace.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mjg59@google.com \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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.