mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	naveen.n.rao@linux.ibm.com, anil.s.keshavamurthy@intel.com,
	davem@davemloft.net, linux-trace-kernel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kprobes: Replace memcpy() with direct assignment
Date: Fri, 3 Feb 2023 22:05:36 +0900	[thread overview]
Message-ID: <20230203220536.ae8b91c4f0c92ac2640694b6@kernel.org> (raw)
In-Reply-To: <1675166510-7798-1-git-send-email-yangtiezhu@loongson.cn>

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>

      reply	other threads:[~2023-02-03 13:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 12:01 Tiezhu Yang
2023-02-03 13:05 ` Masami Hiramatsu [this message]

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=20230203220536.ae8b91c4f0c92ac2640694b6@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=yangtiezhu@loongson.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®