lkml.org 
[lkml]   [2020]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [tip: core/kprobes] arm/ftrace: Use __patch_text()
On Thu, Jan 23, 2020 at 12:26:46AM +0300, Dmitry Osipenko wrote:
> 04.12.2019 11:33, tip-bot2 for Peter Zijlstra пишет:
> > @@ -97,10 +94,7 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
> > return -EINVAL;
> > }
> >
> > - if (probe_kernel_write((void *)pc, &new, MCOUNT_INSN_SIZE))
> > - return -EPERM;
> > -
> > - flush_icache_range(pc, pc + MCOUNT_INSN_SIZE);
> > + __patch_text((void *)pc, new);
> >
> > return 0;
> > }
> >
>
> Hello,
>
> NVIDIA Tegra20/30 are not booting with CONFIG_FTRACE=y, but even with
> CONFIG_FTRACE=n things are not working well.

Ooh, I think I see. Can you try this:

diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index 2a5ff69c28e6..10499d44964a 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -78,13 +78,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
{
unsigned long replaced;

- if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
+ if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
old = __opcode_to_mem_thumb32(old);
- new = __opcode_to_mem_thumb32(new);
- } else {
+ else
old = __opcode_to_mem_arm(old);
- new = __opcode_to_mem_arm(new);
- }

if (validate) {
if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))
\
 
 \ /
  Last update: 2020-02-07 12:28    [W:0.130 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site