NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/38697: new module code can't do deps properly



>Number:         38697
>Category:       kern
>Synopsis:       new module code can't do deps properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 18 23:10:04 +0000 2008
>Originator:     Andrew Doran
>Release:        4.99.62
>Organization:
The NetBSD Project
>Environment:
n/a
>Description:
Relocations are done in a single pass. The general flow is:

kobj_open_file: initialize kobj_t, obtain vnode
kobj_load: load object, do all relocs
... read name from modinfo_t
kobj_set_name: register module with ksyms
kobj_close: purge unneeded data structures, close vnode (if applicable)
... now load requisite modules

The link may fail at kobj_load due to a requisite module not being
present, because needed symbols may not be in the global symbol table.

>How-To-Repeat:
Code inspection.
>Fix:
Change the flow of events to look something like this:

kobj_open_file: initialize kobj_t, obtain vnode
kobj_load: load object, do only STB_LOCAL relocs, close vnode
... read name from modinfo_t
... load requisite modules
if (success) {
   kobj_affix: register module with ksyms (replacing kobj_set_name),
   perform STB_GLOBAL relocs, purge unneeded data structures, but
   preserve kobj_t for kobj_unload
} else {
   kobj_abort: purge unneeded data structures, free module text/data,
   free kobj_t
}



Home | Main Index | Thread Index | Old Index