From: Oleg Nesterov <oleg@redhat.com>
To: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
Cc: Lukasz Pawelczyk <havner@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>,
David Rientjes <rientjes@google.com>,
Sameer Nanda <snanda@chromium.org>,
Guillaume Morin <guillaume@morinfr.org>,
Li Zefan <lizefan@huawei.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/exit.c: make sure current's nsproxy != NULL while checking caps
Date: Wed, 26 Nov 2014 21:52:30 +0100 [thread overview]
Message-ID: <20141126205230.GA22121@redhat.com> (raw)
In-Reply-To: <1417011661-19230-1-git-send-email-l.pawelczyk@samsung.com>
On 11/26, Lukasz Pawelczyk wrote:
>
> My understanding is that while we have to use task_nsproxy()
task_nsproxy() has already gone... probably this doesn't matter but which
kernel version ?
> task's nsproxy and check whether it's NULL, for the 'current' we don't
> have to and it's expected not to be NULL.
Well, unless exit_task_namespaces() was called ;)
> There seem to be no crash currently because of this, but with other LSM
> modules or in future there might be. This is the backtrace:
Confused... backtrace of what? did kernel crash or what?
> 0 smk_tskacc (task=0xffff88003b0b92e0, obj_known=0x2 <irq_stack_union+2>, mode=2, a=0xffff88003be53dd8) at security/smack/smack_access.c:261
> 1 0xffffffff8130e2aa in smk_curacc (obj_known=<optimized out>, mode=<optimized out>, a=<optimized out>) at security/smack/smack_access.c:318
> 2 0xffffffff8130a50d in smack_task_kill (p=0xffff88003b0b92e0, info=<optimized out>, sig=<optimized out>, secid=<optimized out>) at security/smack/smack_lsm.c:2071
I do not know this code, so could you please tell more? How/wher smk_tskacc()
uses ->nsproxy? smack_access.c:261 leads to the comment header above smk_curacc()
in my tree, so this tells me nothing.
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -751,7 +751,6 @@ void do_exit(long code)
> exit_fs(tsk);
> if (group_dead)
> disassociate_ctty(1);
> - exit_task_namespaces(tsk);
> exit_task_work(tsk);
> exit_thread();
>
> @@ -773,6 +772,13 @@ void do_exit(long code)
> flush_ptrace_hw_breakpoint(tsk);
>
> exit_notify(tsk, group_dead);
> +
> + /*
> + * This should be after all things that pottentially require
> + * process's namespaces (e.g. capability checks).
> + */
> + exit_task_namespaces(tsk);
> +
> proc_exit_connector(tsk);
Well, we can probably move exit_task_namespaces() down (perhaps we even
want to move it after exit_task_work).
But I am not sure about exit_notify(), in this case free_nsproxy() can
be called when the caller is already reaped.
In any case, please more details?
Oleg.
next prev parent reply other threads:[~2014-11-26 20:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 14:21 Lukasz Pawelczyk
2014-11-26 20:52 ` Oleg Nesterov [this message]
2014-11-27 10:55 ` Lukasz Pawelczyk
2014-11-26 21:32 ` David Rientjes
2014-11-27 11:01 ` Lukasz Pawelczyk
2014-12-01 21:08 ` David Rientjes
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=20141126205230.GA22121@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=guillaume@morinfr.org \
--cc=havner@gmail.com \
--cc=l.pawelczyk@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mhocko@suse.cz \
--cc=rientjes@google.com \
--cc=snanda@chromium.org \
/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®