linux/scripts
Alex Smith 27a623e7d1 recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules
commit 91ad11d7cc upstream.

On MIPS calls to _mcount in modules generate 2 instructions to load
the _mcount address (and therefore 2 relocations). The mcount_loc
table should only reference the first of these, so the second is
filtered out by checking the relocation offset and ignoring ones that
immediately follow the previous one seen.

However if a module has an _mcount call at offset 0, the second
relocation would not be filtered out due to old_r_offset == 0
being taken to mean that the current relocation is the first one
seen, and both would end up in the mcount_loc table.

This results in ftrace_make_nop() patching both (adjacent)
instructions to branches over the _mcount call sequence like so:

  0xffffffffc08a8000:  04 00 00 10     b       0xffffffffc08a8014
  0xffffffffc08a8004:  04 00 00 10     b       0xffffffffc08a8018
  0xffffffffc08a8008:  2d 08 e0 03     move    at,ra
  ...

The second branch is in the delay slot of the first, which is
defined to be unpredictable - on the platform on which this bug was
encountered, it triggers a reserved instruction exception.

Fix by initializing old_r_offset to ~0 and using that instead of 0
to determine whether the current relocation is the first seen.

Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7098/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-06 18:57:26 -07:00
..
basic
coccinelle scripts: Coccinelle script for pm_runtime_* return checks with IS_ERR_VALUE 2014-01-03 14:39:35 +01:00
dtc
genksyms
kconfig localmodconfig: Add config depends by default settings 2013-12-20 17:02:44 -05:00
ksymoops
mod Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm 2014-03-07 17:39:32 -08:00
package builddeb: use $OBJCOPY variable instead of objcopy 2014-06-30 20:12:02 -07:00
rt-tester
selinux
tracing
.gitignore
analyze_suspend.py PM / tools: new tool for suspend/resume performance optimization 2014-01-17 01:47:26 +01:00
asn1_compiler.c X.509: remove possible code fragility: enumeration values not handled 2013-09-25 17:17:01 +01:00
bin2c.c
bloat-o-meter scripts/bloat-o-meter: use .startswith rather than fragile slicing 2013-11-07 10:47:13 +01:00
bootgraph.pl
checkincludes.pl
checkkconfigsymbols.sh scripts/checkkconfigsymbols.sh: replace echo -e with printf 2013-08-28 17:00:47 +02:00
checkpatch.pl checkpatch: fix detection of git repository 2014-02-10 16:01:40 -08:00
checkstack.pl
checksyscalls.sh
checkversion.pl
cleanfile
cleanpatch
coccicheck Coccinelle: Update information about the minimal version required 2013-07-03 22:58:20 +02:00
config scripts/config: fix variable substitution command 2013-09-13 13:06:59 +02:00
conmakehash.c
decodecode
depmod.sh
diffconfig diffconfig: Update script to support python versions 2.5 through 3.3 2013-09-01 21:24:51 +02:00
docproc.c kernel-doc: improve "no structured comments found" error 2013-11-13 12:09:32 +09:00
export_report.pl
extract-ikconfig
extract-vmlinux
gcc-goto.sh arm64, jump label: detect %c support for ARM64 2014-01-08 15:21:29 +00:00
gcc-version.sh
gcc-x86_32-has-stack-protector.sh
gcc-x86_64-has-stack-protector.sh
gen_initramfs_list.sh scripts/gen_initramfs_list.sh: fix flags for initramfs LZ4 compression 2014-03-04 07:55:48 -08:00
get_maintainer.pl get_maintainer: fix detection of git repository 2014-02-10 16:01:40 -08:00
gfp-translate
headerdep.pl
headers_check.pl headers_check: special case seqbuf_dump() 2014-01-23 16:36:55 -08:00
headers_install.sh
headers.sh
kallsyms.c revert "kallsyms: fix absolute addresses for kASLR" 2014-03-10 17:26:20 -07:00
Kbuild.include
kernel-doc Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2013-11-15 14:09:15 -08:00
Lindent
link-vmlinux.sh scripts/link-vmlinux.sh: only filter kernel symbols for arm 2013-12-10 16:49:19 +10:30
Makefile
Makefile.asm-generic
Makefile.build
Makefile.clean
Makefile.fwinst
Makefile.headersinst
Makefile.help
Makefile.host
Makefile.lib of: Move testcase FDT data into drivers/of 2014-02-20 11:52:08 +00:00
Makefile.modbuiltin
Makefile.modinst
Makefile.modpost modpost: Optionally ignore secondary errors seen if a single module build fails 2013-09-23 15:45:03 +09:30
Makefile.modsign
makelst
markup_oops.pl
mkcompile_h
mkmakefile
mksysmap
mkuboot.sh
mkversion
module-common.lds
namespace.pl
patch-kernel
pnmtologo.c
profile2linkerlist.pl
recordmcount.c
recordmcount.h recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules 2014-07-06 18:57:26 -07:00
recordmcount.pl ftrace: default to tilegx if ARCH=tile is specified 2013-12-05 15:59:26 -05:00
setlocalversion Fix detectition of kernel git repository in setlocalversion script [take #2] 2014-01-03 14:48:42 +01:00
show_delta show_delta: Update script to support python versions 2.5 through 3.3 2013-10-23 17:13:42 +02:00
sign-file
sortextable.c microblaze: extable: sort the exception table at build time 2014-01-23 16:36:50 -08:00
sortextable.h scripts/sortextable: support objects with more than 64K sections. 2013-11-13 12:09:00 +09:00
tags.sh scripts/tags.sh: remove obsolete __devinit[const|data] 2013-11-08 10:57:20 +01:00
unifdef.c
ver_linux
xz_wrap.sh