* [PATCH] kprobes: Replace memcpy() with direct assignment
@ 2023-01-31 12:01 Tiezhu Yang
2023-02-03 13:05 ` Masami Hiramatsu
0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2023-01-31 12:01 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, naveen.n.rao,
anil.s.keshavamurthy, davem
Cc: linux-trace-kernel, linux-kernel
Just do a direct assignment, then give a chance to probe memcpy()
for some archs or kernel versions which do not blacklist memcpy().
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
kernel/kprobes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 1c18ecf..5a3cf9f 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -407,8 +407,8 @@ static inline bool kprobe_unused(struct kprobe *p)
/* Keep all fields in the kprobe consistent. */
static inline void copy_kprobe(struct kprobe *ap, struct kprobe *p)
{
- memcpy(&p->opcode, &ap->opcode, sizeof(kprobe_opcode_t));
- memcpy(&p->ainsn, &ap->ainsn, sizeof(struct arch_specific_insn));
+ p->opcode = ap->opcode;
+ p->ainsn = ap->ainsn;
}
#ifdef CONFIG_OPTPROBES
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kprobes: Replace memcpy() with direct assignment
2023-01-31 12:01 [PATCH] kprobes: Replace memcpy() with direct assignment Tiezhu Yang
@ 2023-02-03 13:05 ` Masami Hiramatsu
0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2023-02-03 13:05 UTC (permalink / raw)
To: Tiezhu Yang
Cc: Steven Rostedt, naveen.n.rao, anil.s.keshavamurthy, davem,
linux-trace-kernel, linux-kernel
On Tue, 31 Jan 2023 20:01:50 +0800
Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
> Just do a direct assignment, then give a chance to probe memcpy()
> for some archs or kernel versions which do not blacklist memcpy().
>
NACK, because this is not invoked from kprobe int3 handling code.
Thank you,
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> kernel/kprobes.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 1c18ecf..5a3cf9f 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -407,8 +407,8 @@ static inline bool kprobe_unused(struct kprobe *p)
> /* Keep all fields in the kprobe consistent. */
> static inline void copy_kprobe(struct kprobe *ap, struct kprobe *p)
> {
> - memcpy(&p->opcode, &ap->opcode, sizeof(kprobe_opcode_t));
> - memcpy(&p->ainsn, &ap->ainsn, sizeof(struct arch_specific_insn));
> + p->opcode = ap->opcode;
> + p->ainsn = ap->ainsn;
> }
>
> #ifdef CONFIG_OPTPROBES
> --
> 2.1.0
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-03 13:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-31 12:01 [PATCH] kprobes: Replace memcpy() with direct assignment Tiezhu Yang
2023-02-03 13:05 ` Masami Hiramatsu
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).