Re: freeing a static after one use only?

From: Peter T. Breuer (ptb@it.uc3m.es)
Date: Sun Feb 20 2000 - 19:02:01 EST


> On Sat, 19 Feb 2000, Peter T. Breuer wrote:
> > ucName[count] = ucIndexName[i]; // write to first from second
> > } else {
> > printk (KERN_INFO "lost key %d: %u\n", count, key);
> > ucName[count] = "????";
> ^^^^
> I've no idea what the rest of your code is doing, but if ucName[] is
> being filled with pointers like this one.. across modules, it doesn't
> matter much if you overran your array or not. (&"whatever" points to
> Nirvana after module is unloaded)

That is true. I never exercised that code. Yes, that code would have
oopsed later when the second module was unloaded. But the second module
has not been unloaded. Both modules are there.

The oops happens in code that works fine in the first module. It has
been transplanted into the second module and both modules are loaded.

I've been doing some more experiments and some thinking.

I don't see how the compiler can avoid giving possibly overlapping
addresses to constant data in different modules. It doesn't know
about the other module. So it must be up to modprobe to remap ...

.. and how can modprobe guarantee to avoid overlaps? It would need
to check the whole map of kernel data structures. Surely it can't
do that reliably? It would have to follow a heuristic rather than
a algorithm for mapping areas, no?

I would almost suspect that modutils don't expect constant data
of more than one page in size. Is that it?

Peter

-
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/



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:26 EST