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
(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.
Created attachment 167417 [details] proposed patch
(In reply to Gleb Smirnoff from comment #2) Works fine for me. Thanks!
Please commit, if you don't see any issues with it.
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