public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Xiaotian Feng <xtfeng@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Sasha Levin <sasha.levin@oracle.com>
Subject: Re: [ipc,shm] BUG: lock held when returning to user space!
Date: Sat, 27 Jul 2013 21:34:39 +0800	[thread overview]
Message-ID: <20130727133439.GA14847@localhost> (raw)
In-Reply-To: <1374338805.2184.3.camel@buesod1.americas.hpqcorp.net>

On Sat, Jul 20, 2013 at 09:46:45AM -0700, Davidlohr Bueso wrote:
> On Sun, 2013-07-21 at 00:02 +0800, Xiaotian Feng wrote:
> > On Sat, Jul 20, 2013 at 9:13 PM, Fengguang Wu <fengguang.wu@intel.com> wrote:
> > > Greetings,
> > >
> > > I got the below dmesg and the first bad commit is
> > >
> > > commit c5d0282a0405b0a81fa3390e4230e4cbb3ced7a2
> > > Author: Davidlohr Bueso <davidlohr.bueso@hp.com>
> > > Date:   Fri Jul 19 09:56:58 2013 +1000
> > >
> > >     ipc,shm: shorten critical region for shmat
> > >
> > >     Similar to other system calls, acquire the kern_ipc_perm lock after doing
> > >     the initial permission and security checks.
> > >
> > >     Signed-off-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
> > >     Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> > >     Cc: Rik van Riel <riel@redhat.com>
> > >     Cc: Manfred Spraul <manfred@colorfullife.com>
> > >     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > >
> > > [   20.702156]
> > > [   20.702493] ================================================
> > > [   20.703511] [ BUG: lock held when returning to user space! ]
> > > [   20.704532] 3.11.0-rc1-next-20130719 #50 Not tainted
> > > [   20.705416] ------------------------------------------------
> > > [   20.706425] trinity-child0/174 is leaving the kernel with locks still held!
> > > [   20.707638] 1 lock held by trinity-child0/174:
> > > [   20.708475]  #0:  (rcu_read_lock){.+.+..}, at: [<ffffffff814a8491>] do_shmat+0xe1/0x500
> > >
> > 
> > ----
> > ns = current->nsproxy->ipc_ns;
> > - shp = shm_lock_check(ns, shmid);
> > + rcu_read_lock();
> > + shp = shm_obtain_object_check(ns, shmid);
> > if (IS_ERR(shp)) {
> > err = PTR_ERR(shp);
> > goto out;
> > ----
> > 
> > If shm_obtain_object_check() failed, goto out will return with
> > rcu_read_lock() held.  I think following patch should cure this.
> 
> Yep that should solve it, sorry about that. Sasha Levin sent out a fix
> for it yesterday (offline).

What's the patch's status? The bug is still there in linux-next 20130726.

Thanks,
Fengguang

  reply	other threads:[~2013-07-27 13:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-20 13:13 [ipc,shm] BUG: lock held when returning to user space! Fengguang Wu
2013-07-20 16:02 ` Xiaotian Feng
2013-07-20 16:46   ` Davidlohr Bueso
2013-07-27 13:34     ` Fengguang Wu [this message]
2013-08-02  4:02       ` Davidlohr Bueso

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=20130727133439.GA14847@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidlohr.bueso@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    --cc=xtfeng@gmail.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