Re: [Patch 4/5] module: trim exception table in module_free()

From: Amerigo Wang
Date: Sun Jun 07 2009 - 21:27:48 EST


Rusty Russell wrote:
On Thu, 4 Jun 2009 06:27:06 pm Amerigo Wang wrote:
Rusty Russell wrote:
I've taken this one to make it more generic. I'll leave the x86
maintainers to apply the rest.
Thank you. But this one depends on the previous, I don't think you can
apply this without the previous ones.

Here's what I ended up with: I need to rig up a test and make sure it goes to
all the maintainers and linux-next.

Subject: module: trim exception table on init free.

It's theoretically possible that there are exception table entries
which point into the (freed) init text of modules. These could cause
future problems if other modules get loaded into that memory and cause
an exception as we'd see the wrong fixup.

Amerigo fixed this long-standing FIXME in the x86 version, but this
patch is more general.

This implements trim_init_extable(); most archs are simple since they
use the standard lib/extable.c sort code. Alpha and IA64 use relative
addresses in their fixups, so thier trimming is a slight variation.

Sparc32 is unique; it doesn't seem to define ARCH_HAS_SORT_EXTABLE,
yet it defines its own sort_extable() which overrides the one in lib.
It doesn't sort, so we have to mark deleted entries instead of
actually trimming them.

Inspired-by: Amerigo Wang <amwang@xxxxxxxxxx>
Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

Very nice!
The generic part of this patch looks good for me, of course. :)

Thank you, Rusty!


--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html