i just came across a problem with dynamic sysctls:
when unloading a driver module that used dyn sysctls, my system paniced
with "oid too high". that problem is caused by sysctl_ctx_free() in
kern/kern_sysctl.c, that first deregisters all oids in the list to see if
a error occurs. then, all oids are being reregistered and, if there was no
error, they're finally removed.
during the second phase, sysctl_register_oid(e1->entry) is called with
n := e1->entry->oid_number being the old oid number with n >
that leads to panic("static sysctl too high") in sysctl_register_oid.
one approach might be to initialize the oid_number field to contain the
value OID_AUTO before calling sysctl_regiser_oid, but i'm unsure about the
side effects of doing that in sysctl_ctx_free().
alternatively, the "old" oid number could be reused, the following patch
should do, but it's just a workaround.


"Sorry, no defects found. Please try a different search"

Index: kern_sysctl.c
RCS file: /usr/cvs/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.113
diff -r1.113 kern_sysctl.c
> static struct sysctl_oid *
> sysctl_find_oidnumber(const int number, struct sysctl_oid_list *list)
> {
>       struct sysctl_oid *oidp;
>       SLIST_FOREACH(oidp, list, oid_link) {
>               if (oidp->oid_number == number) {
>                       return (oidp);
>               }
>       }
>       return (NULL);
> }
<               panic("static sysctl oid too high: %d", oidp->oid_number);
>               if (sysctl_find_oidnumber(oidp->oid_number, parent))
>                       panic("static sysctl oid too high: %d", oidp->oid_number);
<               if (error)
>               if (error)

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to