lkml.org 
[lkml]   [1999]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Serial driver size reducing (2.3.29)
Keith Owens writes:
> We are in violent agreement. Initialization functions that might be
> need by external modules must *not* be marked __init. But you seem to
> assume that all __init definitions are correct where I am not so sure.
>
> The problem is that if some function is incorrectly marked as __init
> then it does not cause a problem at the moment because modules ignore
> __init. When __init in a module is honoured, incorrect code that is
> currently getting away with it will start breaking.
>
> IMHO this is a good thing(TM). Bugs should be found and stamped on.
> But I'm not going to make a kernel change with that potential impact at
> this stage in the 2.3 cycle unless the major kernel developers agree
> that this is desirable.
>
> So Linus, Alan, David et al. Do you want module support for __init
> given that any incorrect existing __init code will break? My gut
> feeling is that it will take 3-5 kernel releases before all the broken
> code is found. OTOH we might get lucky and find that all the __init
> definitions are perfect.

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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.041 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site