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-05-31 19:32:37 +00:00
2012-08-16 13:01:56 +00:00
2012-08-17 02:47:16 +00:00
2012-08-28 19:30:29 +00:00
2012-08-22 20:01:57 +00:00
2012-03-28 20:58:30 +00:00
2012-08-11 23:48:39 +00:00
2011-07-10 00:53:04 +00:00
2012-06-25 05:41:16 +00:00
2012-09-04 23:16:55 +00:00
2012-02-01 14:34:52 +00:00
2012-01-26 16:35:09 +00:00
2012-06-11 18:47:26 +00:00
2012-09-14 21:28:56 +00:00
2012-08-08 00:20:30 +00:00
2012-08-17 02:47:16 +00:00
2012-01-02 12:12:10 +00:00
2012-08-15 22:12:01 +00:00