From: Vasiliy Kulikov <segoon@openwall.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: kernel-hardening@lists.openwall.com,
Randy Dunlap <rdunlap@xenotime.net>,
Andrew Morton <akpm@linux-foundation.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
"Serge E. Hallyn" <serge.hallyn@canonical.com>,
Daniel Lezcano <daniel.lezcano@free.fr>,
Tejun Heo <tj@kernel.org>, Ingo Molnar <mingo@elte.hu>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: [kernel-hardening] Re: [RFC] ipc: introduce shm_rmid_forced sysctl
Date: Mon, 4 Jul 2011 19:36:44 +0400 [thread overview]
Message-ID: <20110704153644.GB21350@albatros> (raw)
In-Reply-To: <20110704150859.GB6893@redhat.com>
On Mon, Jul 04, 2011 at 17:08 +0200, Oleg Nesterov wrote:
> On 06/22, Vasiliy Kulikov wrote:
> >
> > +void exit_shm(struct task_struct *task)
> > +{
> > + struct nsproxy *nsp = task->nsproxy;
> > + struct ipc_namespace *ns;
> > +
> > + if (!nsp)
> > + return;
> > + ns = nsp->ipc_ns;
> > + if (!ns || !ns->shm_rmid_forced)
>
> This looks confusing, imho. How it is possible that ->nsproxy or
> ->ipc_ns is NULL?
I spotted the same checking logic in other places. I don't know whether
it is redundant, I guess it can happen when the namespace is dying.
Probably it cannot happed inside of task do_exit(), only for extern
observers.
> > + return;
> > +
> > + /* Destroy all already created segments, but not mapped yet */
> > + down_write(&shm_ids(ns).rw_mutex);
> > + idr_for_each(&shm_ids(ns).ipcs_idr, &shm_try_destroy_current, ns);
> > up_write(&shm_ids(ns).rw_mutex);
>
> Again, I do not pretend I understand ipc/, but it seems we can check
> ns->ipc_ids[].in_use != 0 before the slow path, no?
Looks like you're right. Given it is do_exit(), the boost is
significant.
I'll send the patch for this thing and the locking part.
Thank you!
--
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments
next prev parent reply other threads:[~2011-07-04 15:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 15:25 [kernel-hardening] [RFC] ipc: introduce shm_rmid_forced sysctl Vasiliy Kulikov
2011-06-22 16:03 ` [kernel-hardening] " Randy Dunlap
2011-06-29 22:14 ` Andrew Morton
2011-06-30 9:21 ` Vasiliy Kulikov
2011-06-30 13:08 ` Vasiliy Kulikov
2011-07-01 11:25 ` Ingo Molnar
2011-07-01 11:35 ` Vasiliy Kulikov
2011-07-01 12:04 ` Ingo Molnar
2011-07-01 14:18 ` Alan Cox
2011-07-03 19:38 ` Ingo Molnar
2011-07-03 21:25 ` Alan Cox
2011-07-02 16:50 ` Solar Designer
2011-07-02 17:31 ` Solar Designer
2011-07-04 15:08 ` Oleg Nesterov
2011-07-04 15:36 ` Vasiliy Kulikov [this message]
2011-07-04 15:44 ` Oleg Nesterov
2011-07-04 16:06 ` Vasiliy Kulikov
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=20110704153644.GB21350@albatros \
--to=segoon@openwall.com \
--cc=akpm@linux-foundation.org \
--cc=daniel.lezcano@free.fr \
--cc=ebiederm@xmission.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=rdunlap@xenotime.net \
--cc=serge.hallyn@canonical.com \
--cc=tj@kernel.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