dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/scripts
Olof Johansson 731ece41fb modpost: Fix address calculation in reloc_location()
This patch fixes a segfault in modpost that is observed when the gold
linker is used to link the input objects.

The problem is that reloc_location (modpost.c) is computing the
address of the relocation target incorrectly. Here, elf->hdr points
to the beginning of the ELF file in memory, sechdr points to the
relocation section header, section is the index of the section
being relocated, and sechdrs[section].sh_offset would be the offset
of that section, relative to the beginning of the ELF file. Adding
elf->hdr + sechdrs[section].sh_offset gives you the address of the
beginning of the section, and adding r->r_offset to that gives you the
address of the location to be relocated. You do not need to subtract
sechdrs[section].sh_addr from that -- the result of this is an address
outside the file, and causes the segfault when addend_386_rel tries to
dereference it.

This bug is not observed when GNU ld is used to link the inputs. The
object file ubuntu/omnibook/omnibook.o is the result of an ld -r of
several other files.  When GNU ld does an ld -r, it sets the vaddr
field for each section to 0, but gold lays out the section addresses
sequentially instead:

Section Headers:
 [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
 [ 0]                   NULL            00000000 000000 000000 00      0   0  0
 [ 1] .text             PROGBITS        00000000 000034 004794 00  AX  0   0  4
 [ 2] .data             PROGBITS        0000b9d0 0047c8 0009c0 00  WA  0   0  4
 [ 3] .bss              NOBITS          000162f8 005188 00013c 00  WA  0   0  4
 [ 4] .rodata.str1.1    PROGBITS        00004f2d 0052c4 001b1a 01 AMS  0   0  1
 [ 5] .init.text        PROGBITS        00004794 006dde 0005fa 00  AX  0   0  1
 [ 6] .exit.text        PROGBITS        00004d8e 0073d8 00018a 00  AX  0   0  1
  ...

So the bug in the tool remained undiscovered because the section's vaddr
always happened to be 0.

Signed-off-by: Raymes Khoury <raymes@google.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-12-28 00:22:58 +01:00
..
basic Make fixdep error handling more explicit 2010-12-22 23:23:28 +01:00
coccinelle Coccinelle: Find doubled arguments to boolean or bit operators. 2010-10-28 00:32:23 +02:00
dtc scripts/dtc: Fix a resource leak 2010-07-02 13:51:11 +02:00
genksyms scripts/genksyms: fix header usage 2010-11-25 16:25:06 +01:00
kconfig kconfig: Have streamline_config process menuconfigs too 2010-10-29 01:07:23 -04:00
ksymoops
mod modpost: Fix address calculation in reloc_location() 2010-12-28 00:22:58 +01:00
package Merge branch 'packaging' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2010-10-28 16:19:38 -07:00
rt-tester scripts: change scripts to use system python instead of env 2010-02-02 14:33:56 +01:00
selinux selinux: fix warning in genheaders 2010-03-16 08:47:36 +11:00
tracing tracing, perf: Convert the power tracer into an event tracer 2009-09-19 11:42:12 +02:00
.gitignore kconfig: simplification of scripts/extract-ikconfig 2009-10-07 11:44:18 -04:00
Kbuild.include kbuild: generate modules.builtin 2009-12-12 13:08:16 +01:00
Lindent scripts/Lindent: support gnu indent v2.2.10 2008-04-29 08:06:04 -07:00
Makefile ftrace/x86: Add support for C version of recordmcount 2010-10-14 16:52:41 -04:00
Makefile.build Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2010-10-21 16:42:32 -07:00
Makefile.clean kbuild: Really don't clean bounds.h and asm-offsets.h 2010-03-11 11:15:22 +01:00
Makefile.fwinst firmware: silence __fw_modbuild and __fw_modinst 'Nothing to be done' messages 2008-08-02 07:52:29 +01:00
Makefile.headersinst kbuild: drop unifdef-y support 2010-08-14 22:26:52 +02:00
Makefile.help Add a target to use the Coccinelle checker 2010-06-12 00:00:29 +02:00
Makefile.host kbuild: fix some minor typoes 2008-04-25 20:18:48 +02:00
Makefile.lib Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2010-10-28 15:13:55 -07:00
Makefile.modbuiltin kbuild: Create output directory in Makefile.modbuiltin 2010-06-10 12:23:08 +02:00
Makefile.modinst Revert "kbuild: strip generated symbols from *.ko" 2009-01-14 21:38:20 +01:00
Makefile.modpost trivial: fix a typo in a filename 2010-08-03 14:59:50 +02:00
bin2c.c
bloat-o-meter fix bloat-o-meter for ppc64 2007-12-17 19:28:17 -08:00
bootgraph.pl bootgraph: fix for use with dot symbols 2009-02-15 12:50:08 +01:00
checkincludes.pl checkincludes: fix perlcritic warnings 2010-03-07 21:19:57 +01:00
checkkconfigsymbols.sh checkkconfigsymbols.sh: Kconfig symbols sometimes have lowercase letters 2010-06-03 10:39:39 +02:00
checkpatch.pl semaphore: Remove mutex emulation 2010-10-30 12:12:50 +02:00
checkstack.pl scripts: improve checkstack 2010-03-07 21:19:09 +01:00
checksyscalls.sh checksyscalls: Fix stand-alone usage 2010-12-20 15:40:33 +01:00
checkversion.pl checkversion: perl cleanup 2010-03-07 21:22:56 +01:00
cleanfile scripts: Make cleanfile/cleanpatch warn about long lines 2007-07-16 21:15:50 +02:00
cleanpatch scripts: Make cleanfile/cleanpatch warn about long lines 2007-07-16 21:15:50 +02:00
coccicheck Coccinelle: Add contextual message 2010-10-28 00:32:23 +02:00
config kbuild: add generic --set-str option to scripts/config 2009-06-14 22:48:08 +02:00
conmakehash.c Fix all -Wmissing-prototypes warnings in x86 defconfig 2009-09-23 07:39:28 -07:00
decodecode scripts: decodecode: remove bashisms 2010-06-04 10:26:35 +02:00
diffconfig kconfig: add diffconfig utility 2008-07-25 22:12:41 +02:00
export_report.pl export_report: fix perl warnings 2010-03-07 21:41:04 +01:00
extract-ikconfig scripts/extract-ikconfig: add support for bzip2, lzma and lzo 2010-10-28 00:22:17 +02:00
gcc-goto.sh jump label: Fix GCC feature check when distcc is used 2010-09-24 09:12:25 +02:00
gcc-version.sh Remove bashisms from scripts 2009-06-09 22:37:54 +02:00
gcc-x86_32-has-stack-protector.sh stackprotector: fix multi-word cross-builds 2009-02-11 12:17:29 +01:00
gcc-x86_64-has-stack-protector.sh stackprotector: fix multi-word cross-builds 2009-02-11 12:17:29 +01:00
gen_initramfs_list.sh Merge branch 'for-35' of git://repo.or.cz/linux-kbuild 2010-06-01 08:55:52 -07:00
get_maintainer.pl scripts/get_maintainer.pl: don't deduplicate unnamed addresses ie: mailing lists 2010-10-26 16:52:17 -07:00
gfp-translate tree-wide: Assorted spelling fixes 2010-02-09 11:13:56 +01:00
headerdep.pl headerdep: perlcritic warning 2010-03-23 12:26:38 +01:00
headers.sh kbuild: introduce HDR_ARCH_LIST for headers_install_all 2010-12-14 22:16:19 +01:00
headers_check.pl headers_check: fix perl warnings 2010-03-07 21:43:07 +01:00
headers_install.pl headers_install: check exit status of unifdef 2010-12-14 15:06:04 +01:00
kallsyms.c scripts/kallsyms: Enable error messages while hush up unnecessary warnings 2010-09-29 16:18:27 +02:00
kernel-doc docbook: warn on unused doc entries 2010-09-11 16:49:21 -07:00
makelst kbuild: introduce ccflags-y, asflags-y and ldflags-y 2007-10-15 22:25:06 +02:00
markup_oops.pl Merge branch 'for-35' of git://repo.or.cz/linux-kbuild 2010-06-01 08:55:52 -07:00
mkcompile_h scripts/mkcompile_h: don't test for hardcoded paths 2010-02-02 14:33:56 +01:00
mkmakefile fixes for using make 3.82 2010-08-17 11:47:40 +02:00
mksysmap Revert "kbuild: strip generated symbols from *.ko" 2009-01-14 21:38:20 +01:00
mkuboot.sh kbuild/mkuboot.sh: allow spaces in CROSS_COMPILE 2007-05-02 20:58:10 +02:00
mkversion
module-common.lds linker script: throw away .discard section 2009-06-24 15:13:38 +09:00
namespace.pl Revert "namespace: add source file location exceptions" 2010-10-28 00:59:56 +02:00
patch-kernel bugfix for scripts/patch-kernel in 2.6 sublevel stepping 2008-08-06 22:11:33 +02:00
pnmtologo.c fbdev: work around old compiler bug 2009-06-30 18:55:59 -07:00
profile2linkerlist.pl profile2linkerlist: fix perl warnings 2010-03-07 21:39:33 +01:00
recordmcount.c ftrace/MIPS: Add module support for C version of recordmcount 2010-10-29 19:08:55 +01:00
recordmcount.h ftrace/MIPS: Add module support for C version of recordmcount 2010-10-29 19:08:55 +01:00
recordmcount.pl ARM: 6319/1: ftrace: add Thumb-2 support to dynamic ftrace 2010-09-02 15:28:43 +01:00
setlocalversion Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2010-10-28 15:13:55 -07:00
show_delta scripts: change scripts to use system python instead of env 2010-02-02 14:33:56 +01:00
tags.sh Revert "kbuild: specify absolute paths for cscope" 2010-03-08 10:26:22 +01:00
unifdef.c unifdef: update to upstream revision 1.190 2009-12-12 13:08:16 +01:00
ver_linux Remove bashisms from scripts 2009-06-09 22:37:54 +02:00