I think we should make the change, and we should do it so that we
insure code which accesses __init sections *will* break, rather than
"maybe break some time later in a production kernel".
I suggest that insmod puts __init data in a special section, asks the
kernel to make a temporary mapping of page(s) into a region which
normally has no mappings in kernel space, and writes the __init
section to those page(s).
When the init_module() function returns, insmod tells the kernel to
unmap the page(s). Any subsequent references to the __init section
will generate an Oops, rather than yielding undefined behaviour.
The only corner case is when an old __init section is referenced while
a new module is being loaded. If we're concerned about that, we could
simply cycle through a few groups of pages in the normally unmapped
region.
Hm. It occurs to me that the kernel could use a similar technique for
built-in __init sections. If it doesn't already (I haven't checked),
I think it should. Better to make sure something bogus will break,
rather than waiting for undefined==Oops.
Regards,
Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/