svn commit: r253255 - head/sys/netgraph/bluetooth/drivers/ubt

Craig Rodrigues rodrigc at FreeBSD.org
Sat Jul 13 10:31:37 UTC 2013


On Sat, Jul 13, 2013 at 12:31 AM, Mikolaj Golub <trociny at freebsd.org> wrote:

>
> Your patch looks similar to Marko's:
>
>
> http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20121115/0824ca85/attachment.diff
>
>
>


> Also, as I understand, after handling vnet context in
> device_probe_and_attach(), there is no need in curvnet setting in
> kldload/kldunload, and Marko removed it.
>

I experimented with Marko's patch, and found that the kernel crashed
inside the code which initializes PF.

(kgdb) where
#0  doadump (textdump=<value optimized out>) at
pcpu.h:234

#1  0xffffffff80923e06 in kern_reboot
(howto=260)

    at
/usr/home/rodrigc/freebsd/9/sys/kern/kern_shutdown.c:449

#2  0xffffffff80924307 in panic (fmt=0x1 <Address 0x1 out of
bounds>)

    at
/usr/home/rodrigc/freebsd/9/sys/kern/kern_shutdown.c:637

#3  0xffffffff80ce9820 in trap_fatal (frame=0xc, eva=<value optimized
out>)

    at
/usr/home/rodrigc/freebsd/9/sys/amd64/amd64/trap.c:879

#4  0xffffffff80ce9b81 in trap_pfault (frame=0xffffff8128845050,
usermode=0)

    at
/usr/home/rodrigc/freebsd/9/sys/amd64/amd64/trap.c:795

#5  0xffffffff80cea134 in trap
(frame=0xffffff8128845050)

    at
/usr/home/rodrigc/freebsd/9/sys/amd64/amd64/trap.c:463

#6  0xffffffff80cd3463 in calltrap () at
/usr/home/rodrigc/freebsd/9/sys/amd64/amd64/exception.S:228

#7  0xffffffff820a0fb4 in init_zone_var
()

    at
/usr/home/rodrigc/freebsd/9/sys/modules/pf/../../contrib/pf/net/pf_ioctl.c:295

#8  0xffffffff820a34db in pf_modevent (mod=<value optimized out>,
type=<value optimized
out>,
    data=<value optimized out>)
    at
/usr/home/rodrigc/freebsd/9/sys/modules/pf/../../contrib/pf/net/pf_ioctl.c:4342
#9  0xffffffff8090ea48 in module_register_init (arg=<value optimized out>)
    at /usr/home/rodrigc/freebsd/9/sys/kern/kern_module.c:123
#10 0xffffffff809069ce in linker_load_module (kldname=<value optimized
out>,
    modname=0xfffffe000730bc00 "pf", parent=0x0, verinfo=0x0,
lfpp=0xffffff8128845958)
    at /usr/home/rodrigc/freebsd/9/sys/kern/kern_linker.c:237
#11 0xffffffff80907008 in kern_kldload (td=0xfffffe0007e10920, file=<value
optimized out>,
---Type <return> to continue, or q <return> to quit---
    fileid=0xffffff81288459b4) at
/usr/home/rodrigc/freebsd/9/sys/kern/kern_linker.c:1031
#12 0xffffffff80907224 in sys_kldload (td=0xfffffe0007e10920, uap=<value
optimized out>)
    at /usr/home/rodrigc/freebsd/9/sys/kern/kern_linker.c:1062
#13 0xffffffff80ce8fca in amd64_syscall (td=0xfffffe0007e10920, traced=0)
at subr_syscall.c:135
#14 0xffffffff80cd3747 in Xfast_syscall ()
    at /usr/home/rodrigc/freebsd/9/sys/amd64/amd64/exception.S:387
#15 0x000000080087e10c in ?? ()

#7  0xffffffff820a0fb4 in init_zone_var ()
    at
/usr/home/rodrigc/freebsd/9/sys/modules/pf/../../contrib/pf/net/pf_ioctl.c:295
295     {
(kgdb) l
290
291             mtx_destroy(&pf_task_mtx);
292     }
293     void
294     init_zone_var(void)
295     {
296             V_pf_src_tree_pl = V_pf_rule_pl = NULL;
297             V_pf_state_pl = V_pf_state_key_pl = V_pf_state_item_pl =
NULL;
298             V_pf_altq_pl = V_pf_pooladdr_pl = NULL;
299             V_pf_frent_pl = V_pf_frag_pl = V_pf_cache_pl = V_pf_cent_pl
= NULL;

In init_zone_var(), curthread->td_vnet was NULL.

So, I don't think it is safe to remove the vnet stuff from
kldload/kldunload just yet,
without fixing some code in some kernel modules like PF.

The other parts of the patch look OK.
--
Craig


More information about the svn-src-head mailing list