sbuf_new_auto() sleeps, and ng_hci_default_rcvmsg() can run under the
raw HCI socket pcb mutex held across NG_SEND_MSG_PATH().
Reported by: WITNESS
Fixes: ad91d47db306
Differential D59550
ng_hci: build the devd notification in a stack buffer Authored by seuros on Wed, Sep 9, 9:19 PM. Tags None Referenced Files
Details sbuf_new_auto() sleeps, and ng_hci_default_rcvmsg() can run under the Reported by: WITNESS
Diff Detail
Event Timeline
Comment Actions This thread is sleepable in theory, cause it is userland ioctl() on a netgraph socket. So you could indeed maneuver around the lock. But there is no strong rule in netgraph that would say certain kind of a message shall be received only in a sleepable thread. A message can be received from an other node and thread context would an interrupt. Ideally such rules probably shall exists, e.g. some messages shall come only from userland. But we aren't there yet. Given that, I would say patch is good enough for now. Comment Actions glebius says it's okay so I say it's okay :-) (what we could do to avoid the stack allocation is to pre-allocate the sbuf generated string component and attach that to the node softc so we can just dup/copy/reference it as needed and just avoid the sbuf-per-notification-in-potentially-sleeping-context problem, but we can tackle that later.) | ||||||||||||||||||||||||||||||||||||||||||||||