lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071027084713.72733460@laptopd505.fenrus.org>
Date:	Sat, 27 Oct 2007 08:47:13 -0700
From:	Arjan van de Ven <arjan@...radead.org>
To:	Jiri Kosina <jikos@...os.cz>
Cc:	Gabriel C <nix.or.die@...glemail.com>, a.zummo@...ertech.it,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	rtc-linux@...glegroups.com, Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: BUG: lock held when returning to user space

On Sat, 27 Oct 2007 17:12:41 +0200 (CEST)
Jiri Kosina <jikos@...os.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.

> Peter, what is the preferred way to annotate these kinds of locking
> for lockdep to express that it is intended?

the preferred method is to not use a mutex like this...


-- 
If you want to reach me at my work email, use arjan@...ux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ