mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
80e5302e4b
An impending change to enable HAVE_C_RECORDMCOUNT on powerpc leads to warnings such as the following: # modprobe kprobe_example ftrace-powerpc: Not expected bl: opcode is 3c4c0001 WARNING: CPU: 0 PID: 227 at kernel/trace/ftrace.c:2001 ftrace_bug+0x90/0x318 Modules linked in: CPU: 0 PID: 227 Comm: modprobe Not tainted 5.2.0-rc6-00678-g1c329100b942 #2 NIP: c000000000264318 LR: c00000000025d694 CTR: c000000000f5cd30 REGS: c000000001f2b7b0 TRAP: 0700 Not tainted (5.2.0-rc6-00678-g1c329100b942) MSR: 900000010282b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE,TM[E]> CR: 28228222 XER: 00000000 CFAR: c0000000002642fc IRQMASK: 0 <snip> NIP [c000000000264318] ftrace_bug+0x90/0x318 LR [c00000000025d694] ftrace_process_locs+0x4f4/0x5e0 Call Trace: [c000000001f2ba40] [0000000000000004] 0x4 (unreliable) [c000000001f2bad0] [c00000000025d694] ftrace_process_locs+0x4f4/0x5e0 [c000000001f2bb90] [c00000000020ff10] load_module+0x25b0/0x30c0 [c000000001f2bd00] [c000000000210cb0] sys_finit_module+0xc0/0x130 [c000000001f2be20] [c00000000000bda4] system_call+0x5c/0x70 Instruction dump: 419e0018 2f83ffff 419e00bc 2f83ffea 409e00cc 4800001c 0fe00000 3c62ff96 39000001 39400000 386386d0 480000c4 <0fe00000> 3ce20003 39000001 3c62ff96 ---[ end trace 4c438d5cebf78381 ]--- ftrace failed to modify [<c0080000012a0008>] 0xc0080000012a0008 actual: 01:00:4c:3c Initializing ftrace call sites ftrace record flags: 2000000 (0) expected tramp: c00000000006af4c Looking at the relocation records in __mcount_loc shows a few spurious entries: RELOCATION RECORDS FOR [__mcount_loc]: OFFSET TYPE VALUE 0000000000000000 R_PPC64_ADDR64 .text.unlikely+0x0000000000000008 0000000000000008 R_PPC64_ADDR64 .text.unlikely+0x0000000000000014 0000000000000010 R_PPC64_ADDR64 .text.unlikely+0x0000000000000060 0000000000000018 R_PPC64_ADDR64 .text.unlikely+0x00000000000000b4 0000000000000020 R_PPC64_ADDR64 .init.text+0x0000000000000008 0000000000000028 R_PPC64_ADDR64 .init.text+0x0000000000000014 The first entry in each section is incorrect. Looking at the relocation records, the spurious entries correspond to the R_PPC64_ENTRY records: RELOCATION RECORDS FOR [.text.unlikely]: OFFSET TYPE VALUE 0000000000000000 R_PPC64_REL64 .TOC.-0x0000000000000008 0000000000000008 R_PPC64_ENTRY *ABS* 0000000000000014 R_PPC64_REL24 _mcount <snip> The problem is that we are not validating the return value from get_mcountsym() in sift_rel_mcount(). With this entry, mcountsym is 0, but Elf_r_sym(relp) also ends up being 0. Fix this by ensuring mcountsym is valid before processing the entry. Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Tested-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> |
||
---|---|---|
.. | ||
atomic | ||
basic | ||
coccinelle | ||
dtc | ||
gcc-plugins | ||
gdb | ||
genksyms | ||
kconfig | ||
ksymoops | ||
mod | ||
package | ||
selinux | ||
tracing | ||
.gitignore | ||
adjust_autoksyms.sh | ||
asn1_compiler.c | ||
bin2c.c | ||
bloat-o-meter | ||
bootgraph.pl | ||
bpf_helpers_doc.py | ||
cc-can-link.sh | ||
check_extable.sh | ||
checkincludes.pl | ||
checkkconfigsymbols.py | ||
checkpatch.pl | ||
checkstack.pl | ||
checksyscalls.sh | ||
checkversion.pl | ||
clang-version.sh | ||
cleanfile | ||
cleanpatch | ||
coccicheck | ||
config | ||
conmakehash.c | ||
const_structs.checkpatch | ||
decode_stacktrace.sh | ||
decodecode | ||
depmod.sh | ||
diffconfig | ||
documentation-file-ref-check | ||
export_report.pl | ||
extract-cert.c | ||
extract-ikconfig | ||
extract-module-sig.pl | ||
extract-sys-certs.pl | ||
extract-vmlinux | ||
extract_xc3028.pl | ||
faddr2line | ||
file-size.sh | ||
find-unused-docs.sh | ||
gcc-goto.sh | ||
gcc-ld | ||
gcc-plugin.sh | ||
gcc-version.sh | ||
gcc-x86_32-has-stack-protector.sh | ||
gcc-x86_64-has-stack-protector.sh | ||
gen_compile_commands.py | ||
gen_ksymdeps.sh | ||
get_dvb_firmware | ||
get_maintainer.pl | ||
gfp-translate | ||
headerdep.pl | ||
headers.sh | ||
headers_check.pl | ||
headers_install.sh | ||
insert-sys-cert.c | ||
kallsyms.c | ||
Kbuild.include | ||
Kconfig.include | ||
kernel-doc | ||
ld-version.sh | ||
leaking_addresses.pl | ||
Lindent | ||
link-vmlinux.sh | ||
Makefile | ||
Makefile.asm-generic | ||
Makefile.build | ||
Makefile.clean | ||
Makefile.dtbinst | ||
Makefile.extrawarn | ||
Makefile.gcc-plugins | ||
Makefile.headersinst | ||
Makefile.host | ||
Makefile.kasan | ||
Makefile.kcov | ||
Makefile.lib | ||
Makefile.modbuiltin | ||
Makefile.modinst | ||
Makefile.modpost | ||
Makefile.modsign | ||
Makefile.ubsan | ||
makelst | ||
markup_oops.pl | ||
mkcompile_h | ||
mkmakefile | ||
mksysmap | ||
mkuboot.sh | ||
module-common.lds | ||
modules-check.sh | ||
namespace.pl | ||
objdiff | ||
parse-maintainers.pl | ||
patch-kernel | ||
pnmtologo.c | ||
profile2linkerlist.pl | ||
prune-kernel | ||
recordmcount.c | ||
recordmcount.h | ||
recordmcount.pl | ||
setlocalversion | ||
show_delta | ||
sign-file.c | ||
sortextable.c | ||
sortextable.h | ||
spdxcheck-test.sh | ||
spdxcheck.py | ||
spelling.txt | ||
sphinx-pre-install | ||
split-man.pl | ||
stackdelta | ||
stackusage | ||
subarch.include | ||
tags.sh | ||
unifdef.c | ||
ver_linux | ||
xen-hypercalls.sh | ||
xz_wrap.sh |