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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110715201541.GL2833@ponder.secretlab.ca>
Date:	Fri, 15 Jul 2011 14:15:41 -0600
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Alexander Stein <alexander.stein@...tec-electronic.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: gpiolib.c: possible circular locking dependency detected

On Mon, Jul 11, 2011 at 02:19:55PM +0200, Alexander Stein wrote:
> Hello,
> 
> I used a shell script using /sys/class/gpio to export,set/unset and unexport 
> GPIOs. Upon unexporting GPIOs I get the dmesg shown below. I didn't find any 
> important change in gpiolib.c and fs/sysfs/dir.c between 2.6.39 and git master 
> which would fix this.
> Has somebody an idea about this?

Yeah, there are nasty locking problems in the gpio sysfs interface,
but nobody has completed the work of debugging it.  Someone with some
free cycles could help out here.

g.

> 
> Regards,
> Alexander
> 
> =======================================================
> [ INFO: possible circular locking dependency detected ]
> 2.6.39+ #5
> -------------------------------------------------------
> gpio.sh/765 is trying to acquire lock:
>  (s_active#40){++++.+}, at: [<c10d566d>] sysfs_addrm_finish+0x27/0x4a
> but task is already holding lock:
>  (sysfs_lock){+.+.+.}, at: [<c11664a8>] gpio_unexport+0x27/0x77
> 
> which lock already depends on the new lock.
> the existing dependency chain (in reverse order) is:
> -> #1 (sysfs_lock){+.+.+.}:
>        [<c104f517>] validate_chain.clone.14+0x425/0x518
>        [<c10504d8>] __lock_acquire+0x653/0x6bb
>        [<c1050945>] lock_acquire+0x63/0x7b
>        [<c130b9e8>] mutex_lock_nested+0x45/0x291
>        [<c1166261>] gpio_direction_store+0x20/0xab
>        [<c11bf5e9>] dev_attr_store+0x22/0x27
>        [<c10d4684>] sysfs_write_file+0xb6/0xe9
>        [<c1094841>] vfs_write+0x91/0x10d
>        [<c1094a69>] sys_write+0x3e/0x63
>        [<c130da4c>] sysenter_do_call+0x12/0x32
> 
> -> #0 (s_active#40){++++.+}:
>        [<c104ecea>] check_prev_add+0xd5/0x4dd
>        [<c104f517>] validate_chain.clone.14+0x425/0x518
>        [<c10504d8>] __lock_acquire+0x653/0x6bb
>        [<c1050945>] lock_acquire+0x63/0x7b
>        [<c10d509e>] sysfs_deactivate+0x85/0xba
>        [<c10d566d>] sysfs_addrm_finish+0x27/0x4a
>        [<c10d5ac2>] sysfs_remove_dir+0x5f/0x6d
>        [<c115594d>] kobject_del+0xf/0x5e
>        [<c11c01bd>] device_del+0x12e/0x13a
>        [<c11c01d4>] device_unregister+0xb/0x15
>        [<c11664e9>] gpio_unexport+0x68/0x77
>        [<c1166514>] gpio_free+0x1c/0xa3
>        [<c11665df>] unexport_store+0x44/0x49
>        [<c11c29ec>] class_attr_store+0x25/0x2a
>        [<c10d4684>] sysfs_write_file+0xb6/0xe9
>        [<c1094841>] vfs_write+0x91/0x10d
>        [<c1094a69>] sys_write+0x3e/0x63
>        [<c130da4c>] sysenter_do_call+0x12/0x32
> 
> other info that might help us debug this:
> 
> 3 locks held by gpio.sh/765:
>  #0:  (&buffer->mutex){+.+.+.}, at: [<c10d45f3>] sysfs_write_file+0x25/0xe9
>  #1:  (s_active#52){.+.+.+}, at: [<c10d4669>] sysfs_write_file+0x9b/0xe9
>  #2:  (sysfs_lock){+.+.+.}, at: [<c11664a8>] gpio_unexport+0x27/0x77
> 
> stack backtrace:
> Pid: 765, comm: gpio.sh Not tainted 2.6.39+ #5
> Call Trace:
>  [<c130a450>] ? printk+0x19/0x1b
>  [<c104e2c6>] print_circular_bug+0x94/0x9d
>  [<c104ecea>] check_prev_add+0xd5/0x4dd
>  [<c104f517>] validate_chain.clone.14+0x425/0x518
>  [<c104fc9c>] ? mark_lock+0x208/0x2d7
>  [<c10504d8>] __lock_acquire+0x653/0x6bb
>  [<c104d433>] ? lockdep_init_map+0x8a/0x3c3
>  [<c1051079>] ? trace_hardirqs_on+0xb/0xd
>  [<c1050945>] lock_acquire+0x63/0x7b
>  [<c10d566d>] ? sysfs_addrm_finish+0x27/0x4a
>  [<c10d509e>] sysfs_deactivate+0x85/0xba
>  [<c10d566d>] ? sysfs_addrm_finish+0x27/0x4a
>  [<c10d566d>] sysfs_addrm_finish+0x27/0x4a
>  [<c10d5ac2>] sysfs_remove_dir+0x5f/0x6d
>  [<c115594d>] kobject_del+0xf/0x5e
>  [<c11c01bd>] device_del+0x12e/0x13a
>  [<c11c01d4>] device_unregister+0xb/0x15
>  [<c11664e9>] gpio_unexport+0x68/0x77
>  [<c1165417>] ? gpio_set_value_cansleep+0x1c/0x1c
>  [<c116659b>] ? gpio_free+0xa3/0xa3
>  [<c1166514>] gpio_free+0x1c/0xa3
>  [<c116659b>] ? gpio_free+0xa3/0xa3
>  [<c11665df>] unexport_store+0x44/0x49
>  [<c11c29ec>] class_attr_store+0x25/0x2a
>  [<c10d4684>] sysfs_write_file+0xb6/0xe9
>  [<c1094841>] vfs_write+0x91/0x10d
>  [<c10d45ce>] ? sysfs_poll+0x72/0x72
>  [<c1094a69>] sys_write+0x3e/0x63
>  [<c130da4c>] sysenter_do_call+0x12/0x32
--
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