Panic at USB drive plugging in

Jia-Shiun Li jiashiun at gmail.com
Tue Aug 6 10:42:00 UTC 2013


2013/7/24 下午10:26 於 "Jia-Shiun Li" <jiashiun at gmail.com> 寫道:

> On Wed, Jul 24, 2013 at 4:02 AM, Alexander Motin <mav at freebsd.org> wrote:
> > cam.k kernel module includes all existing periph drivers in one bundle.
> > Loading cam.ko you are probably getting sg driver also, that triggers
> > reported issue. You may try to rip out sg with single line hack to
> module's
> > Makefile. The real fix require looking closer on sg, which I never used.
> >
>
> Indeed. Test result did confirm that if sg is not included in cam.ko
> USB drives will not cause kernel to panic.
>
>
Hi all,

turns out, it may be conflicts between assumed and actual sg usage.

The sg driver specifically assumes a write-read sequence. If a read comes
first it will cause sg to panic at msleep() in sgread. In my case the
process is hald-probe-storage tasting new devices. But it can be as simple
as "dd if=/dev/sgX".
I am wondering that, is sg necessary on FreeBSD? Since most applications
seem to live happily without it in GENERIC kernel. Maybe we can isolate it
from cam.ko to make cam usable as module, and make the standalone sg module
depending on cam module before sg got more resistant to misuse?

Regards,
Jia-Shiun.


More information about the freebsd-current mailing list