Mikolaj Golub 47813f5d94 Kernel and modules have "set_vnet" linker set, where virtualized
global variables are placed. When a module is loaded by link_elf
linker its variables from "set_vnet" linker set are copied to the
kernel "set_vnet" ("modspace") and all references to these variables
inside the module are relocated accordingly.

The issue is when a module is loaded that has references to global
variables from another, previously loaded module: these references are
not relocated so an invalid address is used when the module tries to
access the variable. The example is V_layer3_chain, defined in ipfw
module and accessed from ipfw_nat.

The same issue is with DPCPU variables, which use "set_pcpu" linker
set.

Fix this making the link_elf linker on a module load recognize
"external" DPCPU/VNET variables defined in the previously loaded
modules and relocate them accordingly. For this set_pcpu_list and
set_vnet_list are used, where the addresses of modules' "set_pcpu" and
"set_vnet" linker sets are stored.

Note, archs that use link_elf_obj (amd64) were not affected by this
issue.

Reviewed by:	jhb, julian, zec (initial version)
MFC after:	1 month
2012-09-27 14:55:15 +00:00
..
2012-09-23 08:50:54 +00:00
2012-09-26 09:37:58 +00:00
2012-09-12 10:12:03 +00:00
2012-09-14 22:00:03 +00:00
2012-09-23 19:40:58 +00:00
2012-09-18 08:00:43 +00:00
2012-08-16 19:22:34 +00:00
2012-08-16 13:01:56 +00:00
2012-09-23 09:13:57 +00:00
2012-09-24 03:14:17 +00:00
2012-09-14 21:28:56 +00:00