From: "Björn Töpel" <bjorn@kernel.org>
To: Chen Guokai <chenguokai17@mails.ucas.ac.cn>,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, rostedt@goodmis.org, mingo@redhat.com,
sfr@canb.auug.org.au
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
liaochang1@huawei.com
Subject: Re: [PATCH v6 11/13] riscv/kprobe: Fix instruction simulation of JALR
Date: Tue, 31 Jan 2023 13:51:32 +0100 [thread overview]
Message-ID: <877cx26f57.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <20230127130541.1250865-12-chenguokai17@mails.ucas.ac.cn>
Chen Guokai <chenguokai17@mails.ucas.ac.cn> writes:
> From: Liao Chang <liaochang1@huawei.com>
>
> Set kprobe at 'jalr 1140(ra)' of vfs_write results in the following
> crash:
>
> [ 32.092235] Unable to handle kernel access to user memory without uaccess routines at virtual address 00aaaaaad77b1170
> [ 32.093115] Oops [#1]
> [ 32.093251] Modules linked in:
> [ 32.093626] CPU: 0 PID: 135 Comm: ftracetest Not tainted 6.2.0-rc2-00013-gb0aa5e5df0cb-dirty #16
> [ 32.093985] Hardware name: riscv-virtio,qemu (DT)
> [ 32.094280] epc : ksys_read+0x88/0xd6
> [ 32.094855] ra : ksys_read+0xc0/0xd6
> [ 32.095016] epc : ffffffff801cda80 ra : ffffffff801cdab8 sp : ff20000000d7bdc0
> [ 32.095227] gp : ffffffff80f14000 tp : ff60000080f9cb40 t0 : ffffffff80f13e80
> [ 32.095500] t1 : ffffffff8000c29c t2 : ffffffff800dbc54 s0 : ff20000000d7be60
> [ 32.095716] s1 : 0000000000000000 a0 : ffffffff805a64ae a1 : ffffffff80a83708
> [ 32.095921] a2 : ffffffff80f160a0 a3 : 0000000000000000 a4 : f229b0afdb165300
> [ 32.096171] a5 : f229b0afdb165300 a6 : ffffffff80eeebd0 a7 : 00000000000003ff
> [ 32.096411] s2 : ff6000007ff76800 s3 : fffffffffffffff7 s4 : 00aaaaaad77b1170
> [ 32.096638] s5 : ffffffff80f160a0 s6 : ff6000007ff76800 s7 : 0000000000000030
> [ 32.096865] s8 : 00ffffffc3d97be0 s9 : 0000000000000007 s10: 00aaaaaad77c9410
> [ 32.097092] s11: 0000000000000000 t3 : ffffffff80f13e48 t4 : ffffffff8000c29c
> [ 32.097317] t5 : ffffffff8000c29c t6 : ffffffff800dbc54
> [ 32.097505] status: 0000000200000120 badaddr: 00aaaaaad77b1170 cause: 000000000000000d
> [ 32.098011] [<ffffffff801cdb72>] ksys_write+0x6c/0xd6
> [ 32.098222] [<ffffffff801cdc06>] sys_write+0x2a/0x38
> [ 32.098405] [<ffffffff80003c76>] ret_from_syscall+0x0/0x2
>
> Since the rs1 and rd might be the same one, such as 'jalr 1140(ra)',
> hence it requires obtaining the target address from rs1 followed by
> updating rd.
>
> Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
> Signed-off-by: Liao Chang <liaochang1@huawei.com>
This has already been picked up to riscv-fixes:
https://lore.kernel.org/linux-riscv/167462581691.3015.5045414056306333462.git-patchwork-notify@kernel.org/
No need to have this patch in the series (and dito to
https://lore.kernel.org/linux-riscv/20230127130541.1250865-11-chenguokai17@mails.ucas.ac.cn/
that Guo submitted a fix for).
Björn
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: "Björn Töpel" <bjorn@kernel.org>
To: Chen Guokai <chenguokai17@mails.ucas.ac.cn>,
paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, rostedt@goodmis.org, mingo@redhat.com,
sfr@canb.auug.org.au
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
liaochang1@huawei.com
Subject: Re: [PATCH v6 11/13] riscv/kprobe: Fix instruction simulation of JALR
Date: Tue, 31 Jan 2023 13:51:32 +0100 [thread overview]
Message-ID: <877cx26f57.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <20230127130541.1250865-12-chenguokai17@mails.ucas.ac.cn>
Chen Guokai <chenguokai17@mails.ucas.ac.cn> writes:
> From: Liao Chang <liaochang1@huawei.com>
>
> Set kprobe at 'jalr 1140(ra)' of vfs_write results in the following
> crash:
>
> [ 32.092235] Unable to handle kernel access to user memory without uaccess routines at virtual address 00aaaaaad77b1170
> [ 32.093115] Oops [#1]
> [ 32.093251] Modules linked in:
> [ 32.093626] CPU: 0 PID: 135 Comm: ftracetest Not tainted 6.2.0-rc2-00013-gb0aa5e5df0cb-dirty #16
> [ 32.093985] Hardware name: riscv-virtio,qemu (DT)
> [ 32.094280] epc : ksys_read+0x88/0xd6
> [ 32.094855] ra : ksys_read+0xc0/0xd6
> [ 32.095016] epc : ffffffff801cda80 ra : ffffffff801cdab8 sp : ff20000000d7bdc0
> [ 32.095227] gp : ffffffff80f14000 tp : ff60000080f9cb40 t0 : ffffffff80f13e80
> [ 32.095500] t1 : ffffffff8000c29c t2 : ffffffff800dbc54 s0 : ff20000000d7be60
> [ 32.095716] s1 : 0000000000000000 a0 : ffffffff805a64ae a1 : ffffffff80a83708
> [ 32.095921] a2 : ffffffff80f160a0 a3 : 0000000000000000 a4 : f229b0afdb165300
> [ 32.096171] a5 : f229b0afdb165300 a6 : ffffffff80eeebd0 a7 : 00000000000003ff
> [ 32.096411] s2 : ff6000007ff76800 s3 : fffffffffffffff7 s4 : 00aaaaaad77b1170
> [ 32.096638] s5 : ffffffff80f160a0 s6 : ff6000007ff76800 s7 : 0000000000000030
> [ 32.096865] s8 : 00ffffffc3d97be0 s9 : 0000000000000007 s10: 00aaaaaad77c9410
> [ 32.097092] s11: 0000000000000000 t3 : ffffffff80f13e48 t4 : ffffffff8000c29c
> [ 32.097317] t5 : ffffffff8000c29c t6 : ffffffff800dbc54
> [ 32.097505] status: 0000000200000120 badaddr: 00aaaaaad77b1170 cause: 000000000000000d
> [ 32.098011] [<ffffffff801cdb72>] ksys_write+0x6c/0xd6
> [ 32.098222] [<ffffffff801cdc06>] sys_write+0x2a/0x38
> [ 32.098405] [<ffffffff80003c76>] ret_from_syscall+0x0/0x2
>
> Since the rs1 and rd might be the same one, such as 'jalr 1140(ra)',
> hence it requires obtaining the target address from rs1 followed by
> updating rd.
>
> Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
> Signed-off-by: Liao Chang <liaochang1@huawei.com>
This has already been picked up to riscv-fixes:
https://lore.kernel.org/linux-riscv/167462581691.3015.5045414056306333462.git-patchwork-notify@kernel.org/
No need to have this patch in the series (and dito to
https://lore.kernel.org/linux-riscv/20230127130541.1250865-11-chenguokai17@mails.ucas.ac.cn/
that Guo submitted a fix for).
Björn
next prev parent reply other threads:[~2023-01-31 12:51 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-27 13:05 [PATCH v6 00/13] Add OPTPROBES feature on RISCV Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-01-27 13:05 ` [PATCH v6 01/13] riscv/kprobe: Prepare the skeleton to implement RISCV OPTPROBES Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-01-27 13:05 ` [PATCH v6 02/13] riscv/kprobe: Allocate detour buffer from module region Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-01-27 13:05 ` [PATCH v6 03/13] riscv/kprobe: Add skeleton for preparing optimized kprobe Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-01-27 13:05 ` [PATCH v6 04/13] riscv/kprobe: Add common RVI and RVC instruction decoder code Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-02-01 13:29 ` Björn Töpel
2023-02-01 13:29 ` Björn Töpel
2023-02-02 10:16 ` Conor Dooley
2023-02-02 10:16 ` Conor Dooley
2023-01-27 13:05 ` [PATCH v6 05/13] riscv/kprobe: Introduce free register(s) searching algorithm Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-01-27 13:05 ` [PATCH v6 06/13] riscv/kprobe: Add code to check if kprobe can be optimized Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-02-01 13:30 ` Björn Töpel
2023-02-01 13:30 ` Björn Töpel
2023-01-27 13:05 ` [PATCH v6 07/13] riscv/kprobe: Prepare detour buffer for optimized kprobe Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-02-01 13:30 ` Björn Töpel
2023-02-01 13:30 ` Björn Töpel
2023-01-27 13:05 ` [PATCH v6 08/13] riscv/kprobe: Patch AUIPC/JALR pair to optimize kprobe Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-02-01 13:31 ` Björn Töpel
2023-02-01 13:31 ` Björn Töpel
2023-01-27 13:05 ` [PATCH v6 09/13] riscv/kprobe: Search free registers from unused caller-saved ones Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-02-01 13:31 ` Björn Töpel
2023-02-01 13:31 ` Björn Töpel
2023-02-02 9:08 ` Conor Dooley
2023-02-02 9:08 ` Conor Dooley
2023-01-27 13:05 ` [PATCH v6 10/13] riscv/kprobe: Add instruction boundary check for RVI/RVC hybrid kernel Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-01-27 13:05 ` [PATCH v6 11/13] riscv/kprobe: Fix instruction simulation of JALR Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-01-31 12:51 ` Björn Töpel [this message]
2023-01-31 12:51 ` Björn Töpel
2023-01-27 13:05 ` [PATCH v6 12/13] riscv/kprobe: Move exception related symbols to .kprobe_blacklist Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-02-01 13:30 ` Björn Töpel
2023-02-01 13:30 ` Björn Töpel
2023-01-27 13:05 ` [PATCH v6 13/13] selftest/kprobes: Add testcase for kprobe SYM[+offs] Chen Guokai
2023-01-27 13:05 ` Chen Guokai
2023-01-30 12:31 ` [PATCH v6 00/13] Add OPTPROBES feature on RISCV Björn Töpel
2023-01-30 12:31 ` Björn Töpel
2023-01-30 14:38 ` Xim
2023-01-30 14:38 ` Xim
2023-04-26 18:01 ` Palmer Dabbelt
2023-04-26 18:01 ` Palmer Dabbelt
2023-02-01 13:29 ` Björn Töpel
2023-02-01 13:29 ` Björn Töpel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cx26f57.fsf@all.your.base.are.belong.to.us \
--to=bjorn@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=chenguokai17@mails.ucas.ac.cn \
--cc=liaochang1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mingo@redhat.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rostedt@goodmis.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.