android_kernel_samsung_a7y1.../scripts
Alex Sverdlin 397ad4f8a2 ARM: 8950/1: ftrace/recordmcount: filter relocation types
commit 927d780ee371d7e121cea4fc7812f6ef2cea461c upstream.

Scenario 1, ARMv7
=================

If code in arch/arm/kernel/ftrace.c would operate on mcount() pointer
the following may be generated:

00000230 <prealloc_fixed_plts>:
 230:   b5f8            push    {r3, r4, r5, r6, r7, lr}
 232:   b500            push    {lr}
 234:   f7ff fffe       bl      0 <__gnu_mcount_nc>
                        234: R_ARM_THM_CALL     __gnu_mcount_nc
 238:   f240 0600       movw    r6, #0
                        238: R_ARM_THM_MOVW_ABS_NC      __gnu_mcount_nc
 23c:   f8d0 1180       ldr.w   r1, [r0, #384]  ; 0x180

FTRACE currently is not able to deal with it:

WARNING: CPU: 0 PID: 0 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1ad/0x230()
...
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.116-... #1
...
[<c0314e3d>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14)
[<c03115e9>] (show_stack) from [<c051a7f1>] (dump_stack+0x81/0xa8)
[<c051a7f1>] (dump_stack) from [<c0321c5d>] (warn_slowpath_common+0x69/0x90)
[<c0321c5d>] (warn_slowpath_common) from [<c0321cf3>] (warn_slowpath_null+0x17/0x1c)
[<c0321cf3>] (warn_slowpath_null) from [<c038ee9d>] (ftrace_bug+0x1ad/0x230)
[<c038ee9d>] (ftrace_bug) from [<c038f1f9>] (ftrace_process_locs+0x27d/0x444)
[<c038f1f9>] (ftrace_process_locs) from [<c08915bd>] (ftrace_init+0x91/0xe8)
[<c08915bd>] (ftrace_init) from [<c0885a67>] (start_kernel+0x34b/0x358)
[<c0885a67>] (start_kernel) from [<00308095>] (0x308095)
---[ end trace cb88537fdc8fa200 ]---
ftrace failed to modify [<c031266c>] prealloc_fixed_plts+0x8/0x60
 actual: 44:f2:e1:36
ftrace record flags: 0
 (0)   expected tramp: c03143e9

Scenario 2, ARMv4T
==================

ftrace: allocating 14435 entries in 43 pages
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at kernel/trace/ftrace.c:2029 ftrace_bug+0x204/0x310
CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.5 #1
Hardware name: Cirrus Logic EDB9302 Evaluation Board
[<c0010a24>] (unwind_backtrace) from [<c000ecb0>] (show_stack+0x20/0x2c)
[<c000ecb0>] (show_stack) from [<c03c72e8>] (dump_stack+0x20/0x30)
[<c03c72e8>] (dump_stack) from [<c0021c18>] (__warn+0xdc/0x104)
[<c0021c18>] (__warn) from [<c0021d7c>] (warn_slowpath_null+0x4c/0x5c)
[<c0021d7c>] (warn_slowpath_null) from [<c0095360>] (ftrace_bug+0x204/0x310)
[<c0095360>] (ftrace_bug) from [<c04dabac>] (ftrace_init+0x3b4/0x4d4)
[<c04dabac>] (ftrace_init) from [<c04cef4c>] (start_kernel+0x20c/0x410)
[<c04cef4c>] (start_kernel) from [<00000000>] (  (null))
---[ end trace 0506a2f5dae6b341 ]---
ftrace failed to modify
[<c000c350>] perf_trace_sys_exit+0x5c/0xe8
 actual:   1e:ff:2f:e1
Initializing ftrace call sites
ftrace record flags: 0
 (0)
 expected tramp: c000fb24

The analysis for this problem has been already performed previously,
refer to the link below.

Fix the above problems by allowing only selected reloc types in
__mcount_loc. The list itself comes from the legacy recordmcount.pl
script.

Link: https://lore.kernel.org/lkml/56961010.6000806@pengutronix.de/
Cc: stable@vger.kernel.org
Fixes: ed60453fa8f8 ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 13:44:46 +02:00
..
basic A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
coccinelle fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock 2020-04-06 18:47:45 +02:00
dtbtool_exynos Introduce Exynos dtbtool to the Linux build system 2020-03-27 22:20:07 +05:30
dtc A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fmp A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gdb scripts/gdb: fix debugging modules compiled with hot/cold partitioning 2020-04-07 12:40:58 +02:00
genksyms A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kconfig kconfig: don't crash on NULL expressions in expr_eq() 2020-04-07 13:28:58 +02:00
ksymoops A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mod modpost: skip ELF local symbols during section mismatch check 2020-04-07 12:45:17 +02:00
package A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
selinux A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tracing A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
analyze_suspend.py A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
android-major-version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
android-version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
asn1_compiler.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bloat-o-meter A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bootgraph.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
check_extable.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
check-lc_ctype.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkincludes.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkkconfigsymbols.py A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkpatch.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkstack.pl scripts/checkstack.pl: Fix arm64 wrong or unknown architecture 2020-04-06 19:16:34 +02:00
checksyscalls.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkversion.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
clang-android.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cleanfile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cleanpatch A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
coccicheck A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
config A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
conmakehash.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decode_stacktrace.sh scripts/decode_stacktrace: match basepath using shell prefix operator, not regex 2020-04-06 21:34:57 +02:00
decodecode A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
depmod.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
diffconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
docproc.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
export_report.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-cert.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-ikconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-module-sig.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-sys-certs.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-vmlinux A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
find_matching_major.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
find_matching_version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fips_fmp_hmac.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fips_fmp_utils.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fips_kaslr_fmp_hmac.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-goto.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-ld A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-x86_32-has-stack-protector.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-x86_64-has-stack-protector.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gen_initramfs_list.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
get_dvb_firmware A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
get_maintainer.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gfp-translate A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
headerdep.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
headers_check.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
headers_install.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
headers.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kallsyms.c scripts/kallsyms: fix definitely-lost memory leak 2020-04-07 13:23:33 +02:00
kaslr_fips_fmp.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kaslr_patch.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kbuild.include kbuild: simplify ld-option implementation 2020-04-06 16:38:00 +02:00
kernel-doc A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kernel-doc-xml-ref A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ld-version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Lindent A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
link-vmlinux.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile Introduce Exynos dtbtool to the Linux build system 2020-03-27 22:20:07 +05:30
Makefile.asm-generic A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.build A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.clean A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.dtbinst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.extrawarn A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.fwinst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.headersinst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.help A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.host A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.kasan A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.lib Introduce Exynos dtbtool to the Linux build system 2020-03-27 22:20:07 +05:30
Makefile.modbuiltin A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.modinst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.modpost kbuild: modpost: handle KBUILD_EXTRA_SYMBOLS only for external modules 2020-04-06 20:49:10 +02:00
Makefile.modsign A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
makelst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
markup_oops.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mkcompile_h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mkmakefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mksysmap A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mkuboot.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mkversion A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
module-common.lds A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
namespace.pl namespace: fix namespace.pl script to support relative paths 2020-04-07 09:24:14 +02:00
objdiff A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
patch-kernel A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pnmtologo.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
profile2linkerlist.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
recordmcount.c ARM: 8950/1: ftrace/recordmcount: filter relocation types 2020-04-07 13:44:46 +02:00
recordmcount.h recordmcount: Fix spurious mcount entries on powerpc 2020-04-06 20:06:14 +02:00
recordmcount.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
replace_dir.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
setlocalversion scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks 2020-04-07 09:27:28 +02:00
show_delta A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sign-file.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sortextable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sortextable.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
spelling.txt A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stackdelta A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stackusage A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tags.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
unifdef.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ver_linux A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xen-hypercalls.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xz_wrap.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30