All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH v2 3.16] x86,kprobes: Don't try to resolve kprobe faults from userspace
Date: Mon, 14 Jul 2014 07:39:02 +0900	[thread overview]
Message-ID: <53C30A86.8030806@hitachi.com> (raw)
In-Reply-To: <c4e339882c121aa76254f2adde3fcbdf502faec2.1405099506.git.luto@amacapital.net>

(2014/07/12 2:27), Andy Lutomirski wrote:
> This commit:
> 
>     commit 6f6343f53d133bae516caf3d254bce37d8774625
>     Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>     Date:   Thu Apr 17 17:17:33 2014 +0900
> 
>         kprobes/x86: Call exception handlers directly from do_int3/do_debug
> 
> appears to have inadvertently dropped a check that the int3 came
> from kernel mode.  Trying to dereference addr when addr is
> user-controlled is completely bogus.

Oops, right!

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

Thank you very much!

> 
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> ---
> 
> Changes from v1: Fixed the changelog message
> 
>  arch/x86/kernel/kprobes/core.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
> index 7596df6..67e6d19 100644
> --- a/arch/x86/kernel/kprobes/core.c
> +++ b/arch/x86/kernel/kprobes/core.c
> @@ -574,6 +574,9 @@ int kprobe_int3_handler(struct pt_regs *regs)
>  	struct kprobe *p;
>  	struct kprobe_ctlblk *kcb;
>  
> +	if (user_mode_vm(regs))
> +		return 0;
> +
>  	addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t));
>  	/*
>  	 * We don't want to be preempted for the entire
> 


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



  reply	other threads:[~2014-07-13 22:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 17:27 [PATCH v2 3.16] x86,kprobes: Don't try to resolve kprobe faults from userspace Andy Lutomirski
2014-07-13 22:39 ` Masami Hiramatsu [this message]
2014-07-16 19:23 ` [tip:perf/urgent] kprobes/x86: Don' t " tip-bot for Andy Lutomirski

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=53C30A86.8030806@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=x86@kernel.org \
    /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.