mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Dmitry Kasatkin <d.kasatkin@samsung.com>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	John Johansen <john.johansen@canonical.com>,
	Mimi Zohar <zohar@linux.vnet.ibm.com>,
	James Morris <jmorris@namei.org>,
	viro@zeniv.linux.org.uk,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kernel-team <kernel-team@lists.ubuntu.com>
Subject: Re: Kernel panic at Ubuntu: IMA + Apparmor
Date: Fri, 25 Apr 2014 13:45:17 -0700	[thread overview]
Message-ID: <874n1h16le.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <CACE9dm9gs64C9JfSYKboUOwT_uXC7Ha1kuXsMWOE-0isQuzfmg@mail.gmail.com> (Dmitry Kasatkin's message of "Fri, 25 Apr 2014 23:20:54 +0300")

Dmitry Kasatkin <dmitry.kasatkin@gmail.com> writes:

> On 25 April 2014 23:01, Oleg Nesterov <oleg@redhat.com> wrote:
>> On 04/25, Eric W. Biederman wrote:
>>>
>>> Oleg Nesterov <oleg@redhat.com> writes:
>>>
>>> > Well. I _think_ that __fput() and ima_file_free() in particular should not
>>> > depend on current and/or current->nsproxy. If nothing else, fput() can be
>>> > called by the unrelated task which looks into /proc/pid/.
>>> >
>>> > But again, task_work_add() has more and more users, and it seems that even
>>> > __fput() paths can do "everything", so perhaps it would be safer to allow
>>> > to use ->nsproxy in task_work_run.
>>>
>>> Like I said, give me a clear motivating case.
>>
>> I agree, we need a reason. Currently I do not see one.
>>
>>> Right now not allowing
>>> nsproxy is turning up bugs in __fput.  Which seems like a good thing.
>>
>> This is what I certainly agree with ;)
>>
>
> Hi,
>
> IMA uses kernel_read API which does not know anything about caller.
> And of course security frameworks are at guard as usual.
>
> Exactly after reading first Eric's respons, I thought why to scratch
> the head when task work queues are indeed designed for tasks...

__fput has no guarantee of running in the task that close the file
descriptor.  If your code depends on that your code is broken.

> And if you to dig for the history, IMA-appraisal was stuck due to
> lockdep reporting even though it was on non-everlaping cases.
> IIRC files vs. directories...
>
> After that IIRC Al Viro discussed about delayed fput and IIRC Oleg
> (sorry if I am wrong) introduced task work queues.
>
> So IMA-appraisal was able to be upstreamed... That was ~3.4 time frame, IIRC
>
> Name space also dated around ~3.4??
> Apparmor namespace change was also around that time.
>
> 3.10 introduces this name space order change and broke IMA-appraisal.

IMA-appraisal is fundamentally broken because I can take a mandatory
file lock and prevent IMA-apprasial.

Using kernel_read is what allows this.

> Isn't it a clear motivating case???

kernel_read is not appropriate for IMA use.  The rest of this is just
the messenger.

IMA needs to use a cousin of kernel_read that operates at a lower level
than vfs_read.  A function that all of the permission checks and the
fsnotify work.

I am sorry to be the bearer of bad news.  But kernel_read is totally
inappropriate for IMA.

Eric


  reply	other threads:[~2014-04-25 20:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25 13:00 Dmitry Kasatkin
2014-04-25 14:48 ` Dmitry Kasatkin
2014-04-25 18:23   ` Oleg Nesterov
2014-04-25 19:04     ` Eric W. Biederman
2014-04-25 19:25       ` Oleg Nesterov
2014-04-25 19:40         ` Eric W. Biederman
2014-04-25 20:01           ` Oleg Nesterov
2014-04-25 20:20             ` Dmitry Kasatkin
2014-04-25 20:45               ` Eric W. Biederman [this message]
2014-04-25 20:52                 ` Dmitry Kasatkin
2014-04-25 21:27                   ` Eric W. Biederman
2014-04-25 21:46                     ` Dmitry Kasatkin
2014-04-25 21:56                       ` Dmitry Kasatkin
2014-04-25 22:38                         ` Eric W. Biederman
2014-04-26  8:58                           ` Dmitry Kasatkin
2014-04-26 13:56                             ` Al Viro
2014-04-26 16:54                               ` Dmitry Kasatkin
2014-04-26 17:42                                 ` Al Viro
2014-04-26 19:03                                   ` Dmitry Kasatkin
2014-04-25 22:11                       ` Eric W. Biederman
2014-04-26  8:49                         ` Dmitry Kasatkin
2014-04-25 21:21                 ` Al Viro
2014-04-25 21:43                   ` Eric W. Biederman
2014-04-25 21:55                     ` Al Viro
2014-04-25 22:25                       ` Eric W. Biederman
2014-04-29 13:00                         ` Mimi Zohar

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=874n1h16le.fsf@x220.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=d.kasatkin@samsung.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zohar@linux.vnet.ibm.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

Powered by JetHome