From: Cyrill Gorcunov <gorcunov@openvz.org>
To: Vasiliy Kulikov <segoon@openwall.com>
Cc: Sasha Levin <levinsasha928@gmail.com>,
khlebnikov@openvz.org, xemul@parallels.com,
Dave Jones <davej@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: c/r: broken locking when executing map_files
Date: Mon, 7 May 2012 00:49:04 +0400 [thread overview]
Message-ID: <20120506204904.GA1912@moon> (raw)
In-Reply-To: <20120506202132.GA6570@albatros>
On Mon, May 07, 2012 at 12:21:32AM +0400, Vasiliy Kulikov wrote:
> On Sat, May 05, 2012 at 23:32 +0400, Cyrill Gorcunov wrote:
> > On Sat, May 05, 2012 at 10:53:06PM +0400, Cyrill Gorcunov wrote:
> > > On Sat, May 05, 2012 at 10:20:51PM +0400, Vasiliy Kulikov wrote:
> > > > > - if (lock_trace(task))
> > > > > + if (!ptrace_may_access(task, PTRACE_MODE_READ))
> > > >
> > > > Probably it will be better to change mutex_lock_killable() to
> > > > mutex_lock_killable_nested() inside of lock_trace() instead of this change?
> > > > It would keep the race-free check.
> > >
> > > Yup, if I'm not missing something SINGLE_DEPTH_NESTING should do the trick
> > > for us. I'll test and report.
> >
> > Hmm, this doesn't work well, the mutex remanins killable so when one does
>
> Does it show circular locking? It shouldn't block if it uses
> mutex_lock+mutex_lock_nested.
Nope of course, once mutex_lock_nested called the kernel doesn't complain
anymore, but it rather sleep forever, until task killed, and that is wrong
i think. moreover, since executing from inside of map_files is special one
I think changing the whole lock_trace for this sake is a wrong approach.
>
> > | [root@neptune ~]# /proc/self/map_files/400000-419000
> >
> > it sleeps forever until killed, which is not good I think. Vasiliy, could
> > you remind me what exactly is problem if we use unlocked ptrace_may_access
> > here?
>
> There is a race between ptrace_may_access() and dname_to_vma_addr().
> The target task may do exec() between these calls and
> dname_to_vma_addr() will be called against a privileged task. This may
> lead to a leak of task maps.
Wait, the proc_map_files_lookup requires the caller to be cap-sysadmin
granted, would not this be enough?
Cyrill
next prev parent reply other threads:[~2012-05-06 20:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-02 17:23 c/r: broken locking when executing map_files Sasha Levin
2012-05-02 17:27 ` Cyrill Gorcunov
2012-05-03 17:31 ` Cyrill Gorcunov
2012-05-05 18:20 ` Vasiliy Kulikov
2012-05-05 18:53 ` Cyrill Gorcunov
2012-05-05 19:32 ` Cyrill Gorcunov
2012-05-06 20:21 ` Vasiliy Kulikov
2012-05-06 20:49 ` Cyrill Gorcunov [this message]
2012-05-11 17:56 ` Vasiliy Kulikov
2012-05-11 18:18 ` Cyrill Gorcunov
2012-05-02 17:34 ` Pavel Emelyanov
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=20120506204904.GA1912@moon \
--to=gorcunov@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--cc=khlebnikov@openvz.org \
--cc=levinsasha928@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=segoon@openwall.com \
--cc=xemul@parallels.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 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.