linux/scripts/mod
Mike Frysinger 3a5dd791ab modpost: fix segfault in sym_is() with prefixed arches
The sym_is() compares a symbol in an attempt to automatically skip symbol
prefixes.  It does this first by searching the real symbol with the normal
unprefixed symbol.  But then it uses the length of the original symbol to
check the end of the substring instead of the length of the symbol it is
looking for.  On non-prefixed arches, this is effectively the same thing,
so there is no problem.  On prefixed-arches, since this is exceeds by just
one byte, a crash is rare and it is usually a NUL byte anyways.  But every
once in a blue moon, you get the right page alignment and it segfaults.

For example, on the Blackfin arch, sym_is() will be called with the real
symbol "___mod_usb_device_table" as "symbol" when looking for the normal
symbol "__mod_usb_device_table" as "name".  The substring will thus return
one byte into "symbol" and store it into "match".  But then "match" will
be indexed with the length of "symbol" instead of "name" and so we will
exceed the storage.  i.e. the code ends up doing:
	char foo[] = "abc"; return foo[strlen(foo)+1] == '\0';

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-17 11:00:53 -08:00
..
.gitignore Add some basic .gitignore files 2005-10-18 08:26:15 -07:00
Makefile module: make MODULE_SYMBOL_PREFIX into a CONFIG option 2009-12-15 16:28:26 +10:30
empty.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
file2alias.c modpost: fix segfault in sym_is() with prefixed arches 2010-01-17 11:00:53 -08:00
mk_elfconfig.c module: make MODULE_SYMBOL_PREFIX into a CONFIG option 2009-12-15 16:28:26 +10:30
modpost.c Merge branch 'for-33' of git://repo.or.cz/linux-kbuild 2009-12-17 07:23:42 -08:00
modpost.h Kbuild: clear marker out of modpost 2009-12-15 16:28:31 +10:30
sumversion.c trivial: remove references to non-existent include/linux/config.h 2009-09-21 15:14:52 +02:00