Bug 207497 - [net80211]: 'uma_zalloc_arg: zone "32" with non-sleepable locks held' when 'sysctl net.wlan.devices' is executed
Summary: [net80211]: 'uma_zalloc_arg: zone "32" with non-sleepable locks held' when 's...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Gleb Smirnoff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-25 19:07 UTC by Andriy Voskoboinyk
Modified: 2016-02-26 20:49 UTC (History)
2 users (show)

See Also:


Attachments
proposed patch (886 bytes, text/plain)
2016-02-25 21:12 UTC, Gleb Smirnoff
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-02-25 19:07:21 UTC
How-to-reproduce:
# sysctl net.wlan.devices
<some output here>

In dmesg:
uma_zalloc_arg: zone "32" with the following non-sleepable locks held:
exclusive sleep mutex ieee80211com list (ieee80211com list) r = 0 (0xb08e15a4) locked @ /usr/src/sys/modules/wlan/../../net80211/ieee80211.c:275
stack backtrace:
#0 0xa06fd7c5 at witness_debugger+0x75
#1 0xa06fe9a8 at witness_warn+0x338
#2 0xa083807a at uma_zalloc_arg+0x3a
#3 0xa0684678 at malloc+0x218
#4 0xa06e9fe3 at sbuf_extend+0x63
#5 0xa06e9e2d at sbuf_put_bytes+0x6d
#6 0xa06ea352 at sbuf_putc_func+0x22
#7 0xa06e5b0b at kvprintf+0x99b
#8 0xa06ea3ab at sbuf_printf+0x4b
#9 0xb08667cf at sysctl_ieee80211coms+0xef
#10 0xa06b0bcd at sysctl_root_handler_locked+0xad
#11 0xa06b03e2 at sysctl_root+0x1d2
#12 0xa06b094a at userland_sysctl+0x17a
#13 0xa06b0788 at sys___sysctl+0x98
#14 0xa0899378 at syscall+0x388
#15 0xa0884e7f at Xint0x80_syscall+0x2f
Comment 1 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-02-25 20:12:57 UTC
(Probably, an inelegant) way to fix this issue:
1) lock the mutex;
2) count needed size by iterating over ic_head list;
3) allocate required memory;
4) copy all names to it (yet another iteration);
5) unlock the mutex;
6) pass the data to SYSCTL_OUT()
7) free the memory.
Comment 2 Gleb Smirnoff freebsd_committer freebsd_triage 2016-02-25 21:12:27 UTC
Created attachment 167417 [details]
proposed patch
Comment 3 Andriy Voskoboinyk freebsd_committer freebsd_triage 2016-02-26 19:06:55 UTC
(In reply to Gleb Smirnoff from comment #2)
Works fine for me. Thanks!
Comment 4 Gleb Smirnoff freebsd_committer freebsd_triage 2016-02-26 19:29:58 UTC
Please commit, if you don't see any issues with it.
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-02-26 20:47:56 UTC
A commit references this bug:

Author: avos
Date: Fri Feb 26 20:47:09 UTC 2016
New revision: 296114
URL: https://svnweb.freebsd.org/changeset/base/296114

Log:
  net80211: fix 'uma_zalloc_arg: zone "32" with non-sleepable locks held'
  when 'sysctl net.wlan.devices' is executed.

  PR:		207497
  Submitted by:	glebius
  Approved by:	adrian (mentor)

Changes:
  head/sys/net80211/ieee80211.c