public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Jiri Kosina <jikos@jikos.cz>,
	Gabriel C <nix.or.die@googlemail.com>,
	a.zummo@towertech.it,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	rtc-linux@googlegroups.com
Subject: Re: BUG: lock held when returning to user space
Date: Sat, 27 Oct 2007 18:09:29 +0200	[thread overview]
Message-ID: <1193501369.5648.78.camel@lappy> (raw)
In-Reply-To: <20071027084713.72733460@laptopd505.fenrus.org>


On Sat, 2007-10-27 at 08:47 -0700, Arjan van de Ven wrote:
> On Sat, 27 Oct 2007 17:12:41 +0200 (CEST)
> Jiri Kosina <jikos@jikos.cz> wrote:
> 
> > On Sat, 27 Oct 2007, Gabriel C wrote:
> > 
> > > I found that today in dmesg after booting current git ( 
> > > ec3b67c11df42362ccda81261d62829042f223f0 ) :
> > > ...
> > > [  592.752777]
> > > [  592.752781] ================================================
> > > [  592.753478] [ BUG: lock held when returning to user space! ]
> > > [  592.753880] ------------------------------------------------
> > > [  592.754262] hwclock/1452 is leaving the kernel with locks still
> > > held! [  592.754655] 1 lock held by hwclock/1452:
> > > [  592.755007]  #0:  (&rtc->char_lock){--..}, at: [<c02a7ebb>]
> > > rtc_dev_open+0x2e/0x7e                                        
> > 
> > Yes, this is because rtc keeps a char_lock mutex locked as long as
> > the device is open, to avoid concurrent accessess.
> > 
> > It could be easily substituted by some counting -- setting and
> > clearing bit in struct rtc_device instead of using char_lock, but
> > doing this just to shut the lockdep off is questionable imho.
> 
> it's not about lockdep; what this code doing is not valid use of a
> mutex:
> A mutex is required to have a clear process as owner, and in this case
> it doesn't have that... at all. This is a violation of the kernel mutex
> semantics.. and should be fixed.

Right, the fd could be transferred using unix sockets or fork(). That
would indeed seriously break a mutex.



  reply	other threads:[~2007-10-27 16:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-27 14:19 BUG: lock held when returning to user space Gabriel C
2007-10-27 15:12 ` Jiri Kosina
2007-10-27 15:28   ` Peter Zijlstra
2007-10-27 15:46     ` Andrew Morton
2007-10-28 11:12       ` Jiri Kosina
2007-10-29 12:20         ` Alessandro Zummo
2007-10-27 16:35     ` Linus Torvalds
2007-10-27 22:47     ` Jiri Kosina
2007-10-29 12:20       ` [rtc-linux] " Alessandro Zummo
2007-10-27 15:47   ` Arjan van de Ven
2007-10-27 16:09     ` Peter Zijlstra [this message]
2007-10-27 17:05       ` Arjan van de Ven
  -- strict thread matches above, loose matches on Subject: below --
2008-03-12 15:45 Frank Munzert
2008-03-12 16:29 ` Vegard Nossum
2008-03-12 21:40 ` Jiri Kosina
2008-03-13 15:43   ` Daniel Walker
2008-03-13 17:39     ` Peter Zijlstra
2008-03-13 17:56       ` Daniel Walker
2008-03-13 16:49 J.C. Pizarro

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=1193501369.5648.78.camel@lappy \
    --to=a.p.zijlstra@chello.nl \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=jikos@jikos.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nix.or.die@googlemail.com \
    --cc=rtc-linux@googlegroups.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