* Re: [PATCH] recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64. [not found] <20200717143338.19302-1-gregory.herrero@oracle.com> @ 2020-07-17 17:30 ` Steven Rostedt [not found] ` <20200717200119.GP17377@ltoracle> 2020-07-22 16:36 ` Catalin Marinas 0 siblings, 2 replies; 4+ messages in thread From: Steven Rostedt @ 2020-07-17 17:30 UTC (permalink / raw) To: gregory.herrero Cc: linux-arm-kernel, Catalin Marinas, Will Deacon, linux-kernel, stable On Fri, 17 Jul 2020 16:33:38 +0200 gregory.herrero@oracle.com wrote: > From: Gregory Herrero <gregory.herrero@oracle.com> > > Currently, if a section has a relocation to '_mcount' symbol, a new > __mcount_loc entry will be added whatever the relocation type is. > This is problematic when a relocation to '_mcount' is in the middle of a > section and is not a call for ftrace use. > > Such relocation could be generated with below code for example: > bool is_mcount(unsigned long addr) > { > return (target == (unsigned long) &_mcount); > } > > With this snippet of code, ftrace will try to patch the mcount location > generated by this code on module load and fail with: > > Call trace: > ftrace_bug+0xa0/0x28c > ftrace_process_locs+0x2f4/0x430 > ftrace_module_init+0x30/0x38 > load_module+0x14f0/0x1e78 > __do_sys_finit_module+0x100/0x11c > __arm64_sys_finit_module+0x28/0x34 > el0_svc_common+0x88/0x194 > el0_svc_handler+0x38/0x8c > el0_svc+0x8/0xc > ---[ end trace d828d06b36ad9d59 ]--- > ftrace failed to modify > [<ffffa2dbf3a3a41c>] 0xffffa2dbf3a3a41c > actual: 66:a9:3c:90 > Initializing ftrace call sites > ftrace record flags: 2000000 > (0) > expected tramp: ffffa2dc6cf66724 > > So Limit the relocation type to R_AARCH64_CALL26 as in perl version of > recordmcount. > I'd rather have this go through the arm64 tree, as they can test it better than I can. Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> -- Steve > Fixes: ed60453fa8f8 ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount") > Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com> > --- > scripts/recordmcount.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c > index 7225107a9aaf..e59022b3f125 100644 > --- a/scripts/recordmcount.c > +++ b/scripts/recordmcount.c > @@ -434,6 +434,11 @@ static int arm_is_fake_mcount(Elf32_Rel const *rp) > return 1; > } > > +static int arm64_is_fake_mcount(Elf64_Rel const *rp) > +{ > + return ELF64_R_TYPE(w(rp->r_info)) != R_AARCH64_CALL26; > +} > + > /* 64-bit EM_MIPS has weird ELF64_Rela.r_info. > * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf > * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40] > @@ -547,6 +552,7 @@ static int do_file(char const *const fname) > make_nop = make_nop_arm64; > rel_type_nop = R_AARCH64_NONE; > ideal_nop = ideal_nop4_arm64; > + is_fake_mcount64 = arm64_is_fake_mcount; > break; > case EM_IA_64: reltype = R_IA64_IMM64; break; > case EM_MIPS: /* reltype: e_class */ break; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20200717200119.GP17377@ltoracle>]
* Re: [PATCH] recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64. [not found] ` <20200717200119.GP17377@ltoracle> @ 2020-07-17 20:15 ` Steven Rostedt 0 siblings, 0 replies; 4+ messages in thread From: Steven Rostedt @ 2020-07-17 20:15 UTC (permalink / raw) To: Gregory Herrero Cc: linux-arm-kernel, Catalin Marinas, Will Deacon, linux-kernel, stable On Fri, 17 Jul 2020 22:01:19 +0200 Gregory Herrero <gregory.herrero@oracle.com> wrote: > Thanks Steve. > Should I send a V2 to add 'Cc: stable@vger.kernel.org' in the commit > description or can someone take care of it when adding the commit to > the tree? If I was taking it, I would simply add the Cc: stable@vger.kernel.org to the commit log, and no resend would be needed. It's up to the ARM64 maintainers to decide in this case. Cheers, -- Steve _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64. 2020-07-17 17:30 ` [PATCH] recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64 Steven Rostedt [not found] ` <20200717200119.GP17377@ltoracle> @ 2020-07-22 16:36 ` Catalin Marinas 2020-07-22 18:50 ` Gregory Herrero 1 sibling, 1 reply; 4+ messages in thread From: Catalin Marinas @ 2020-07-22 16:36 UTC (permalink / raw) To: Steven Rostedt Cc: linux-arm-kernel, gregory.herrero, Will Deacon, linux-kernel, stable On Fri, Jul 17, 2020 at 01:30:03PM -0400, Steven Rostedt wrote: > On Fri, 17 Jul 2020 16:33:38 +0200 > gregory.herrero@oracle.com wrote: > > From: Gregory Herrero <gregory.herrero@oracle.com> > > Currently, if a section has a relocation to '_mcount' symbol, a new > > __mcount_loc entry will be added whatever the relocation type is. > > This is problematic when a relocation to '_mcount' is in the middle of a > > section and is not a call for ftrace use. > > > > Such relocation could be generated with below code for example: > > bool is_mcount(unsigned long addr) > > { > > return (target == (unsigned long) &_mcount); > > } > > > > With this snippet of code, ftrace will try to patch the mcount location > > generated by this code on module load and fail with: > > > > Call trace: > > ftrace_bug+0xa0/0x28c > > ftrace_process_locs+0x2f4/0x430 > > ftrace_module_init+0x30/0x38 > > load_module+0x14f0/0x1e78 > > __do_sys_finit_module+0x100/0x11c > > __arm64_sys_finit_module+0x28/0x34 > > el0_svc_common+0x88/0x194 > > el0_svc_handler+0x38/0x8c > > el0_svc+0x8/0xc > > ---[ end trace d828d06b36ad9d59 ]--- > > ftrace failed to modify > > [<ffffa2dbf3a3a41c>] 0xffffa2dbf3a3a41c > > actual: 66:a9:3c:90 > > Initializing ftrace call sites > > ftrace record flags: 2000000 > > (0) > > expected tramp: ffffa2dc6cf66724 > > > > So Limit the relocation type to R_AARCH64_CALL26 as in perl version of > > recordmcount. > > I'd rather have this go through the arm64 tree, as they can test it > better than I can. > > Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Thanks Steve. > > Fixes: ed60453fa8f8 ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount") This Fixes tag looks wrong. The above commit was for arm32. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64. 2020-07-22 16:36 ` Catalin Marinas @ 2020-07-22 18:50 ` Gregory Herrero 0 siblings, 0 replies; 4+ messages in thread From: Gregory Herrero @ 2020-07-22 18:50 UTC (permalink / raw) To: Catalin Marinas Cc: linux-arm-kernel, stable, Will Deacon, linux-kernel, Steven Rostedt On Wed, Jul 22, 2020 at 05:36:50PM +0100, Catalin Marinas wrote: > On Fri, Jul 17, 2020 at 01:30:03PM -0400, Steven Rostedt wrote: > > On Fri, 17 Jul 2020 16:33:38 +0200 > > gregory.herrero@oracle.com wrote: > > > From: Gregory Herrero <gregory.herrero@oracle.com> > > > Currently, if a section has a relocation to '_mcount' symbol, a new > > > __mcount_loc entry will be added whatever the relocation type is. > > > This is problematic when a relocation to '_mcount' is in the middle of a > > > section and is not a call for ftrace use. > > > > > > Such relocation could be generated with below code for example: > > > bool is_mcount(unsigned long addr) > > > { > > > return (target == (unsigned long) &_mcount); > > > } > > > > > > With this snippet of code, ftrace will try to patch the mcount location > > > generated by this code on module load and fail with: > > > > > > Call trace: > > > ftrace_bug+0xa0/0x28c > > > ftrace_process_locs+0x2f4/0x430 > > > ftrace_module_init+0x30/0x38 > > > load_module+0x14f0/0x1e78 > > > __do_sys_finit_module+0x100/0x11c > > > __arm64_sys_finit_module+0x28/0x34 > > > el0_svc_common+0x88/0x194 > > > el0_svc_handler+0x38/0x8c > > > el0_svc+0x8/0xc > > > ---[ end trace d828d06b36ad9d59 ]--- > > > ftrace failed to modify > > > [<ffffa2dbf3a3a41c>] 0xffffa2dbf3a3a41c > > > actual: 66:a9:3c:90 > > > Initializing ftrace call sites > > > ftrace record flags: 2000000 > > > (0) > > > expected tramp: ffffa2dc6cf66724 > > > > > > So Limit the relocation type to R_AARCH64_CALL26 as in perl version of > > > recordmcount. > > > > I'd rather have this go through the arm64 tree, as they can test it > > better than I can. > > > > Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> > > Thanks Steve. > > > > Fixes: ed60453fa8f8 ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount") > > This Fixes tag looks wrong. The above commit was for arm32. > Thanks for catching this. It should be as below instead: Fixes: af64d2aa872a ("ftrace: Add arm64 support to recordmcount") Should I send a V2? Thanks, Greg _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-22 18:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200717143338.19302-1-gregory.herrero@oracle.com>
2020-07-17 17:30 ` [PATCH] recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64 Steven Rostedt
[not found] ` <20200717200119.GP17377@ltoracle>
2020-07-17 20:15 ` Steven Rostedt
2020-07-22 16:36 ` Catalin Marinas
2020-07-22 18:50 ` Gregory Herrero
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).