Message ID | 20221122075440.1165172-1-suagrfillet@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2067961wrr; Tue, 22 Nov 2022 00:06:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf4sxFybPUTU+AkWxHzX0gP0MKvb9PCGzTsjq8lzwdEMqSSSamx7oJq1YsjZB2qqWxw22ePG X-Received: by 2002:a63:e506:0:b0:43c:2e57:9798 with SMTP id r6-20020a63e506000000b0043c2e579798mr4582477pgh.590.1669104416954; Tue, 22 Nov 2022 00:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669104416; cv=none; d=google.com; s=arc-20160816; b=OXOKau9cTecAma1VL7N2+mvmkRm3NkuckbikpHw4dveYSNEIF5xDxzIrCtr7fRBZbo 3CvfIC0C6cR2MdqCH3KFVdKbhJDchyJLodGgeFZ6vRsTM6ZX02fZcWM93QcKnToccpew klwTIHb1Z6Ha8mTsLl6e3Z7romNxI02ruwBaQ0oIX3vR9GMYB3Cgpv5pXohHiOITsBEY 0n9sSlxdP1f1vtjAOcgCRIexXXrjTNjUFyQBw0cDNjvwjT/88wpWTbhi0EjZShqyTLC3 EWJTXD55cSoNEyt1oIzBhha5MJExyex6WNN/1hYnhW7g1jJBvZvw7Pkkxekm3UO214Rm R+qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FaD45/LH3TZ6LbPUcB/tZTNJd6oSSleYgrDKwVHXXS8=; b=EDTh4eqEegDHVTb6gVELNaGjoXFEBkCnKQ+Pg6U3WtyL4kVquEYAUQN4wOGMyDGfe+ 3oQpg2dT+RMfG5lebDMt2UVlT5YdojAeMqQX5isWedRs46tQNF6YVrqnf51oQr1bO0/Q 533g6T/6xe+v+PD3MmMZi0FpSXoQyPj0g9Rz5jWvKg35E9o7HXanF1ZEijTNfX2tazGY pwbePfYdv5+6bZCtMQS2v6TUAeMPxP+UCRyRgehFoAHWX27W/6ArebopiFN0DRlF2mVq TY/zodEN3OfLRmglf/t0SLY1ASgLkUD32xd1h9XzkAqRJdsQ113p38fIfLe1szLbDqxj UkfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VXTHMSvh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z198-20020a6333cf000000b0043f06af773dsi13805070pgz.33.2022.11.22.00.06.43; Tue, 22 Nov 2022 00:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VXTHMSvh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbiKVHzA (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Tue, 22 Nov 2022 02:55:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbiKVHy4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 22 Nov 2022 02:54:56 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88DBD32B9B for <linux-kernel@vger.kernel.org>; Mon, 21 Nov 2022 23:54:51 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so16540905pjc.3 for <linux-kernel@vger.kernel.org>; Mon, 21 Nov 2022 23:54:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FaD45/LH3TZ6LbPUcB/tZTNJd6oSSleYgrDKwVHXXS8=; b=VXTHMSvhK6rf+7XuYyG/Gc5csVm38SGJclqk6icVnehGJCmZm36gv1dNZd/ovtPDJL elT7gvTL5S4ggs/JMsETB9Bd5ncHE2XwVRXV8MU4Nea822u+N5+S2i3hrDshAk7Oj7yz VDNPHxehjxo009md4A5dm5XiKHdp2LGzlHOAeLxGlLQs5ge7QAR5juXK0XJlqwBVIjuf MpJTJhbGkge1ODNOOz2QQymNH52SZbDh1d0nFwp2Lb4d2+b0j8gTyDcW62cnyI0Ej0/o Zqb49YSUw3WjUc1I2LECR2D/U5vtYudC4yB4PvmpHOKeAiQx/AOjp/aNsfOuMBwH7i/s tNrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FaD45/LH3TZ6LbPUcB/tZTNJd6oSSleYgrDKwVHXXS8=; b=zcOM0o55IrMkOPVOjHTk8pwBFdwoq/sObT0rhlvgbsph3YLiSagYTq1Vq4UQ9sy2E+ IMXoT5t9MMZZxOzQdOYdgpbzyWADv1zB9F6eS2hAUwvncvI49PknWEnhjC9oICXsI1ar Oz3VmfehpRl60gTClEX23X+FjciLOGU3XTI+Sw2ww04cAkLXUpWzNrOh9i+X57SA1wws x3celw/+c1sWStKSuXmDmN8oy/bJ23Bj7TiL504WhSXhtC6dLSuVxahRrGbvoa/6fMTy Vh9H3kTOiabx3kX9FlIl9P51mLS4ooBBOa3q6Q6T5tlDY186ioEqz+l0BK0h8qaImFqy Aqzw== X-Gm-Message-State: ANoB5pkzF6zYYukTjYFplE6hQMnqLuDbreTLaTN37EYvz/jrtm4RA0G0 pSUQj0RYn42Vf1iZGTF9BjY= X-Received: by 2002:a17:90a:ac0f:b0:218:bc3e:95f4 with SMTP id o15-20020a17090aac0f00b00218bc3e95f4mr7143299pjq.150.1669103690943; Mon, 21 Nov 2022 23:54:50 -0800 (PST) Received: from localhost.localdomain ([221.226.144.218]) by smtp.gmail.com with ESMTPSA id 131-20020a621689000000b00545f5046372sm9891909pfw.208.2022.11.21.23.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 23:54:50 -0800 (PST) From: Song Shuai <suagrfillet@gmail.com> To: guoren@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Song Shuai <suagrfillet@gmail.com> Subject: [PATCH] riscv/ftrace: fix ftrace_modify_call bug Date: Tue, 22 Nov 2022 15:54:40 +0800 Message-Id: <20221122075440.1165172-1-suagrfillet@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750182833264152729?= X-GMAIL-MSGID: =?utf-8?q?1750182833264152729?= |
Series |
riscv/ftrace: fix ftrace_modify_call bug
|
|
Commit Message
Song Shuai
Nov. 22, 2022, 7:54 a.m. UTC
With this commit (riscv: ftrace: Reduce the detour code size to half)
patched, ftrace bug occurred When hosting kprobe and function tracer
at the same function.
Obviously, the variable caller in ftrace_modify_call was assigned by
rec->ip with 4 offset failing the code replacing at function entry.
And the caller should be assigned by rec->ip directly to indicate
the function entry.
The following is the ftrace bug log.
```
[ 419.632855] 00000000f8776803: expected (ffe00297 1a4282e7) but got (1a8282e7 f0227179)
[ 419.633390] ------------[ ftrace bug ]------------
[ 419.633553] ftrace failed to modify
[ 419.633569] [<ffffffff802091cc>] kernel_read+0x0/0x52
[ 419.633863] actual: 97:02:e0:ff:e7:82:82:1a
[ 419.634087] Updating ftrace call site to call a different ftrace function
[ 419.634279] ftrace record flags: e0000002
[ 419.634487] (2) R
[ 419.634487] expected tramp: ffffffff800093cc
[ 419.634935] ------------[ cut here ]------------
```
Signed-off-by: Song Shuai <suagrfillet@gmail.com>
---
arch/riscv/kernel/ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Nov 22, 2022 at 3:54 PM Song Shuai <suagrfillet@gmail.com> wrote: > > With this commit (riscv: ftrace: Reduce the detour code size to half) > patched, ftrace bug occurred When hosting kprobe and function tracer > at the same function. > > Obviously, the variable caller in ftrace_modify_call was assigned by > rec->ip with 4 offset failing the code replacing at function entry. > And the caller should be assigned by rec->ip directly to indicate > the function entry. Thank you, it's my fault, but I think the problem is: Before (riscv: ftrace: Reduce the detour code size to half) 0: REG_S ra, -SZREG(sp) 4: auipc ra, ? <- We need "rec->ip + 4" here 8: jalr ?(ra) 12: REG_L ra, -SZREG(sp) After (riscv: ftrace: Reduce the detour code size to half) 0: auipc t0, ? <- We needn't "rec->ip + 4" anymore 4: jalr t0, ?(t0) I copied rec->ip + 4 blindly, then caused the bug. Right? > > The following is the ftrace bug log. > > ``` > [ 419.632855] 00000000f8776803: expected (ffe00297 1a4282e7) but got (1a8282e7 f0227179) > [ 419.633390] ------------[ ftrace bug ]------------ > [ 419.633553] ftrace failed to modify > [ 419.633569] [<ffffffff802091cc>] kernel_read+0x0/0x52 > [ 419.633863] actual: 97:02:e0:ff:e7:82:82:1a > [ 419.634087] Updating ftrace call site to call a different ftrace function > [ 419.634279] ftrace record flags: e0000002 > [ 419.634487] (2) R > [ 419.634487] expected tramp: ffffffff800093cc > [ 419.634935] ------------[ cut here ]------------ > ``` > > Signed-off-by: Song Shuai <suagrfillet@gmail.com> > --- > arch/riscv/kernel/ftrace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c > index 8c77f236fc71..61b24d767e2e 100644 > --- a/arch/riscv/kernel/ftrace.c > +++ b/arch/riscv/kernel/ftrace.c > @@ -132,7 +132,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, > unsigned long addr) > { > unsigned int call[2]; > - unsigned long caller = rec->ip + 4; > + unsigned long caller = rec->ip; > int ret; > > make_call_t0(caller, old_addr, call); > -- > 2.20.1 >
On Tue, Nov 22, 2022 at 03:54:40PM +0800, Song Shuai wrote: > With this commit (riscv: ftrace: Reduce the detour code size to half) AFAICT the above patch has not been applied & this patch here should be folded into the offending patch? I've marked this one as "Not Applicable" in patchwork as a result, but let me know if that is an incorrect assumption. Thanks, Conor. > patched, ftrace bug occurred When hosting kprobe and function tracer > at the same function. > > Obviously, the variable caller in ftrace_modify_call was assigned by > rec->ip with 4 offset failing the code replacing at function entry. > And the caller should be assigned by rec->ip directly to indicate > the function entry. > > The following is the ftrace bug log. > > ``` > [ 419.632855] 00000000f8776803: expected (ffe00297 1a4282e7) but got (1a8282e7 f0227179) > [ 419.633390] ------------[ ftrace bug ]------------ > [ 419.633553] ftrace failed to modify > [ 419.633569] [<ffffffff802091cc>] kernel_read+0x0/0x52 > [ 419.633863] actual: 97:02:e0:ff:e7:82:82:1a > [ 419.634087] Updating ftrace call site to call a different ftrace function > [ 419.634279] ftrace record flags: e0000002 > [ 419.634487] (2) R > [ 419.634487] expected tramp: ffffffff800093cc > [ 419.634935] ------------[ cut here ]------------ > ``` > > Signed-off-by: Song Shuai <suagrfillet@gmail.com> > --- > arch/riscv/kernel/ftrace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c > index 8c77f236fc71..61b24d767e2e 100644 > --- a/arch/riscv/kernel/ftrace.c > +++ b/arch/riscv/kernel/ftrace.c > @@ -132,7 +132,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, > unsigned long addr) > { > unsigned int call[2]; > - unsigned long caller = rec->ip + 4; > + unsigned long caller = rec->ip; > int ret; > > make_call_t0(caller, old_addr, call); > -- > 2.20.1 >
Guo Ren <guoren@kernel.org> 于2022年11月22日周二 08:57写道: > > On Tue, Nov 22, 2022 at 3:54 PM Song Shuai <suagrfillet@gmail.com> wrote: > > > > With this commit (riscv: ftrace: Reduce the detour code size to half) > > patched, ftrace bug occurred When hosting kprobe and function tracer > > at the same function. > > > > Obviously, the variable caller in ftrace_modify_call was assigned by > > rec->ip with 4 offset failing the code replacing at function entry. > > And the caller should be assigned by rec->ip directly to indicate > > the function entry. > Thank you, it's my fault, but I think the problem is: > > Before (riscv: ftrace: Reduce the detour code size to half) > 0: REG_S ra, -SZREG(sp) > 4: auipc ra, ? <- We need "rec->ip + 4" here > 8: jalr ?(ra) > 12: REG_L ra, -SZREG(sp) > > After (riscv: ftrace: Reduce the detour code size to half) > 0: auipc t0, ? <- We needn't "rec->ip + 4" anymore > 4: jalr t0, ?(t0) > > I copied rec->ip + 4 blindly, then caused the bug. Right? > Yes, you're right. Here's my simple test case for your convenience. ``` echo kernel_read > set_ftrace_filter echo function > current_tracer echo 'p:myp kernel_read' > kprobe_events echo 1 > events/kprobes/myp/enable # ftrace bug ``` > > > > The following is the ftrace bug log. > > > > ``` > > [ 419.632855] 00000000f8776803: expected (ffe00297 1a4282e7) but got (1a8282e7 f0227179) > > [ 419.633390] ------------[ ftrace bug ]------------ > > [ 419.633553] ftrace failed to modify > > [ 419.633569] [<ffffffff802091cc>] kernel_read+0x0/0x52 > > [ 419.633863] actual: 97:02:e0:ff:e7:82:82:1a > > [ 419.634087] Updating ftrace call site to call a different ftrace function > > [ 419.634279] ftrace record flags: e0000002 > > [ 419.634487] (2) R > > [ 419.634487] expected tramp: ffffffff800093cc > > [ 419.634935] ------------[ cut here ]------------ > > ``` > > > > Signed-off-by: Song Shuai <suagrfillet@gmail.com> > > --- > > arch/riscv/kernel/ftrace.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c > > index 8c77f236fc71..61b24d767e2e 100644 > > --- a/arch/riscv/kernel/ftrace.c > > +++ b/arch/riscv/kernel/ftrace.c > > @@ -132,7 +132,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, > > unsigned long addr) > > { > > unsigned int call[2]; > > - unsigned long caller = rec->ip + 4; > > + unsigned long caller = rec->ip; > > int ret; > > > > make_call_t0(caller, old_addr, call); > > -- > > 2.20.1 > > > > > -- > Best Regards > Guo Ren Thanks, Song
Conor Dooley <conor.dooley@microchip.com> 于2022年11月22日周二 08:57写道: > > On Tue, Nov 22, 2022 at 03:54:40PM +0800, Song Shuai wrote: > > With this commit (riscv: ftrace: Reduce the detour code size to half) > > AFAICT the above patch has not been applied & this patch here should be > folded into the offending patch? > I've marked this one as "Not Applicable" in patchwork as a result, but > let me know if that is an incorrect assumption. > > Thanks, > Conor. > Hi, Conor: Sorry to disturb you with this patch without against the merged commit list, This patch actually is created for fixing (riscv: ftrace: Reduce the detour code size to half) which has not been merged yet. As Guo replied, he will fold it in the target patch. You can ignore this one. Sorry again. BTW, for dispelling your confusion about my email name. Actually, it was misspelled when registering, but I keep it for daily use. So you can send it without concern. :P -- Song Sorry for bothering you with the > > patched, ftrace bug occurred When hosting kprobe and function tracer > > at the same function. > > > > Obviously, the variable caller in ftrace_modify_call was assigned by > > rec->ip with 4 offset failing the code replacing at function entry. > > And the caller should be assigned by rec->ip directly to indicate > > the function entry. > > > > The following is the ftrace bug log. > > > > ``` > > [ 419.632855] 00000000f8776803: expected (ffe00297 1a4282e7) but got (1a8282e7 f0227179) > > [ 419.633390] ------------[ ftrace bug ]------------ > > [ 419.633553] ftrace failed to modify > > [ 419.633569] [<ffffffff802091cc>] kernel_read+0x0/0x52 > > [ 419.633863] actual: 97:02:e0:ff:e7:82:82:1a > > [ 419.634087] Updating ftrace call site to call a different ftrace function > > [ 419.634279] ftrace record flags: e0000002 > > [ 419.634487] (2) R > > [ 419.634487] expected tramp: ffffffff800093cc > > [ 419.634935] ------------[ cut here ]------------ > > ``` > > > > Signed-off-by: Song Shuai <suagrfillet@gmail.com> > > --- > > arch/riscv/kernel/ftrace.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c > > index 8c77f236fc71..61b24d767e2e 100644 > > --- a/arch/riscv/kernel/ftrace.c > > +++ b/arch/riscv/kernel/ftrace.c > > @@ -132,7 +132,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, > > unsigned long addr) > > { > > unsigned int call[2]; > > - unsigned long caller = rec->ip + 4; > > + unsigned long caller = rec->ip; > > int ret; > > > > make_call_t0(caller, old_addr, call); > > -- > > 2.20.1 > >
Guo Ren <guoren@kernel.org> 于2022年11月22日周二 09:29写道: > > > > On Tue, Nov 22, 2022 at 5:11 PM Song Shuai <suagrfillet@gmail.com> wrote: >> >> Guo Ren <guoren@kernel.org> 于2022年11月22日周二 08:57写道: >> > >> > On Tue, Nov 22, 2022 at 3:54 PM Song Shuai <suagrfillet@gmail.com> wrote: >> > > >> > > With this commit (riscv: ftrace: Reduce the detour code size to half) >> > > patched, ftrace bug occurred When hosting kprobe and function tracer >> > > at the same function. >> > > >> > > Obviously, the variable caller in ftrace_modify_call was assigned by >> > > rec->ip with 4 offset failing the code replacing at function entry. >> > > And the caller should be assigned by rec->ip directly to indicate >> > > the function entry. >> > Thank you, it's my fault, but I think the problem is: >> > >> > Before (riscv: ftrace: Reduce the detour code size to half) >> > 0: REG_S ra, -SZREG(sp) >> > 4: auipc ra, ? <- We need "rec->ip + 4" here >> > 8: jalr ?(ra) >> > 12: REG_L ra, -SZREG(sp) >> > >> > After (riscv: ftrace: Reduce the detour code size to half) >> > 0: auipc t0, ? <- We needn't "rec->ip + 4" anymore >> > 4: jalr t0, ?(t0) >> > >> > I copied rec->ip + 4 blindly, then caused the bug. Right? >> > >> Yes, you're right. >> >> Here's my simple test case for your convenience. >> ``` >> echo kernel_read > set_ftrace_filter >> echo function > current_tracer >> echo 'p:myp kernel_read' > kprobe_events >> echo 1 > events/kprobes/myp/enable # ftrace bug > > > Thx, I would fold the patch into (riscv: ftrace: Reduce the detour code size to half). And add Co-developed-by: Song Shuai <suagrfillet@gmail.com> tag on that. > > I would send the v3 series involving your patches. > That's an honor for me. Thanks, Song >> >> ``` >> > > >> > > The following is the ftrace bug log. >> > > >> > > ``` >> > > [ 419.632855] 00000000f8776803: expected (ffe00297 1a4282e7) but got (1a8282e7 f0227179) >> > > [ 419.633390] ------------[ ftrace bug ]------------ >> > > [ 419.633553] ftrace failed to modify >> > > [ 419.633569] [<ffffffff802091cc>] kernel_read+0x0/0x52 >> > > [ 419.633863] actual: 97:02:e0:ff:e7:82:82:1a >> > > [ 419.634087] Updating ftrace call site to call a different ftrace function >> > > [ 419.634279] ftrace record flags: e0000002 >> > > [ 419.634487] (2) R >> > > [ 419.634487] expected tramp: ffffffff800093cc >> > > [ 419.634935] ------------[ cut here ]------------ >> > > ``` >> > > >> > > Signed-off-by: Song Shuai <suagrfillet@gmail.com> >> > > --- >> > > arch/riscv/kernel/ftrace.c | 2 +- >> > > 1 file changed, 1 insertion(+), 1 deletion(-) >> > > >> > > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c >> > > index 8c77f236fc71..61b24d767e2e 100644 >> > > --- a/arch/riscv/kernel/ftrace.c >> > > +++ b/arch/riscv/kernel/ftrace.c >> > > @@ -132,7 +132,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, >> > > unsigned long addr) >> > > { >> > > unsigned int call[2]; >> > > - unsigned long caller = rec->ip + 4; >> > > + unsigned long caller = rec->ip; >> > > int ret; >> > > >> > > make_call_t0(caller, old_addr, call); >> > > -- >> > > 2.20.1 >> > > >> > >> > >> > -- >> > Best Regards >> > Guo Ren >> Thanks, >> Song > > > > -- > Best Regards > Guo Ren
diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c index 8c77f236fc71..61b24d767e2e 100644 --- a/arch/riscv/kernel/ftrace.c +++ b/arch/riscv/kernel/ftrace.c @@ -132,7 +132,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, unsigned long addr) { unsigned int call[2]; - unsigned long caller = rec->ip + 4; + unsigned long caller = rec->ip; int ret; make_call_t0(caller, old_addr, call);