public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>,
	Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>,
	Ingo Molnar <mingo@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] kprobes/x86: boost: Fix checking if there is enough room for a jump
Date: Tue, 02 Jun 2015 06:51:31 +0900	[thread overview]
Message-ID: <556CD3E3.1080605@hitachi.com> (raw)
In-Reply-To: <1433176331-479-2-git-send-email-eugene.shatokhin@rosalab.ru>

On 2015/06/02 1:32, Eugene Shatokhin wrote:
> Kprobes' "boost" feature allows to avoid single-stepping in some cases,
> along with its overhead. It needs a relative jump placed in the insn
> slot right after the instruction. So the length of the instruction plus
> 5 (the length of the near relative unconditional jump) must not exceed
> the length of the slot.
> 
> However, the code currently checks if that sum is strictly less than
> the length of the slot. So "boost" cannot be used for the instructions
> of 10 bytes in size (with MAX_INSN_SIZE == 15), like
> "movabs $0x45525f4b434f4c43,%rax" (48 b8 43 4c 4f 43 4b 5f 52 45),
> "movl $0x1,0xf8dd(%rip)"          (c7 05 dd f8 00 00 01 00 00 00), etc.
> 
> This patch fixes that conditional.

Looks good to me,

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Thanks!

> 
> Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> ---
>  arch/x86/kernel/kprobes/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
> index 1deffe6..0a42b76 100644
> --- a/arch/x86/kernel/kprobes/core.c
> +++ b/arch/x86/kernel/kprobes/core.c
> @@ -881,7 +881,7 @@ static void resume_execution(struct kprobe *p, struct pt_regs *regs,
>  
>  	if (p->ainsn.boostable == 0) {
>  		if ((regs->ip > copy_ip) &&
> -		    (regs->ip - copy_ip) + 5 < MAX_INSN_SIZE) {
> +		    (regs->ip - copy_ip) + 5 <= MAX_INSN_SIZE) {
>  			/*
>  			 * These instructions can be executed directly if it
>  			 * jumps back to correct address.
> 


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com

  reply	other threads:[~2015-06-01 21:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 16:32 [PATCH 0/2] kprobes/x86: Allow "boost" for 10- and 11-byte instructions Eugene Shatokhin
2015-06-01 16:32 ` [PATCH 1/2] kprobes/x86: boost: Fix checking if there is enough room for a jump Eugene Shatokhin
2015-06-01 21:51   ` Masami Hiramatsu [this message]
2015-06-01 16:32 ` [PATCH 2/2] kprobes/x86: Use 16 bytes for each instruction slot again Eugene Shatokhin
2015-06-01 17:04   ` Andy Lutomirski
2015-06-01 21:49     ` Masami Hiramatsu
2015-06-01 21:57       ` Andy Lutomirski
2015-06-02 21:42         ` Masami Hiramatsu
2015-06-02  5:44       ` Ingo Molnar
2015-06-02 21:46         ` Masami Hiramatsu
2015-06-02 21:55           ` Andy Lutomirski
2015-06-04 21:59             ` Masami Hiramatsu
2015-06-03  7:28           ` Ingo Molnar
2015-06-01 21:58   ` Masami Hiramatsu
2015-06-02  5:47   ` Ingo Molnar
2015-06-01 21:44 ` [PATCH 0/2] kprobes/x86: Allow "boost" for 10- and 11-byte instructions Masami Hiramatsu
2015-06-03  7:54 ` [PATCH v2 2/2] kprobes/x86: Use 16 bytes for each instruction slot again Eugene Shatokhin
2015-06-04 14:42   ` Jeff Epler

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=556CD3E3.1080605@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=eugene.shatokhin@rosalab.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    /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