All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: Cyrill Gorcunov <gorcunov@openvz.org>
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: Sat, 5 May 2012 22:20:51 +0400	[thread overview]
Message-ID: <20120505182051.GA16029@albatros> (raw)
In-Reply-To: <20120503173125.GF19347@moon>

Hi Cyrill,

On Thu, May 03, 2012 at 21:31 +0400, Cyrill Gorcunov wrote:
> On Wed, May 02, 2012 at 09:27:56PM +0400, Cyrill Gorcunov wrote:
> > > 
> > > My theory is that files under map_files shouldn't be executable,
> > > but since I'm not sure what the usermode code for c/r does exactly,
> > > I should probably confirm that first. If it's indeed the case, you
> > > can probably skip the rest of this mail.
> > 
> > Thanks Sasha, I'll take a look!
> 
> Sasha, the patch below should fix the lock problem (still I would
> prefer to obtain confirm on patch from Vasiliy, CC'ed).
...
> ---
>  fs/proc/base.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> Index: linux-2.6.git/fs/proc/base.c
> ===================================================================
> --- linux-2.6.git.orig/fs/proc/base.c
> +++ linux-2.6.git/fs/proc/base.c
> @@ -2226,16 +2226,16 @@ static struct dentry *proc_map_files_loo
>  		goto out;
>  
>  	result = ERR_PTR(-EACCES);
> -	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.

Thanks,

-- 
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments

  reply	other threads:[~2012-05-05 18:21 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 [this message]
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
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=20120505182051.GA16029@albatros \
    --to=segoon@openwall.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=gorcunov@openvz.org \
    --cc=khlebnikov@openvz.org \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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.