linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Christophe Leroy <christophe.leroy@c-s.fr>,
	Masami Hiramatsu <mhiramat@kernel.org>
Cc: "Anil S\
	 Keshavamurthy" <anil.s.keshavamurthy@intel.com>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Larry Finger" <Larry.Finger@lwfinger.net>,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Paul Mackerras" <paulus@samba.org>,
	stable@kernel.vger.org
Subject: Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode
Date: Tue, 18 Feb 2020 19:36:51 +0530	[thread overview]
Message-ID: <1582033782.f2l6jsd36b.naveen@linux.ibm.com> (raw)
In-Reply-To: <20200218213317.533c78753cefb05bd42cc6ad@kernel.org>

Masami, Christophe,
Apologies for pitching in late here...

Masami Hiramatsu wrote:
> On Tue, 18 Feb 2020 12:04:41 +0100
> Christophe Leroy <christophe.leroy@c-s.fr> wrote:
> 
>> >> Nevertheless, if one symbol has been forgotten in the blacklist, I think
>> >> it is a problem if it generate Oopses.
>> > 
>> > There is a long history also on x86 to make a blacklist. Anyway, how did
>> > you get this error on PPC32? Somewhere would you like to probe and
>> > it is a real mode function? Or, it happened unexpectedly?
>> 
>> The first Oops I got was triggered by a WARN_ON() kind of trap in real 
>> mode. The trap exception handler called kprobe_handler() which tried to 
>> read the instruction at the trap address (which was a real-mode address) 
>> so it triggered a Bad Access Fault.
>> 
>> This was initially the purpose of my patch.
> 
> OK, then filtering the trap reason in kprobe handler is a bit strange.
> It should be done in the previous stage (maybe in trap.c)
> Can we filter it by exception flag or only by checking the instruction
> which causes the exception, or needs get_kprobe()...?

I think Masami's earlier patch proposal to bail out early from 
kprobe_handler() is appropriate here. We don't support kprobe in real 
mode since we don't have a way to ensure that the pre/post handlers work 
properly.

We will obviously also have to blacklist some of the real mode code from 
being probed to begin with. In addition, we will also have to blacklist 
any location where we can't take a trap (MSR_RI being unset, as an 
example)

Christophe,
See some of the below patch series:
https://patchwork.ozlabs.org/patch/752336/
https://patchwork.ozlabs.org/patch/752333/
https://patchwork.ozlabs.org/patch/782399/


- Naveen


      parent reply	other threads:[~2020-02-18 14:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b1451438f7148ad0e03306a1f1409f4ad1d6ec7c.1581684263.git.christophe.leroy@c-s.fr>
2020-02-15 10:19 ` [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode Christophe Leroy
     [not found] ` <20200214225434.464ec467ad9094961abb8ddc@kernel.org>
2020-02-15 10:28   ` Christophe Leroy
2020-02-16 12:34     ` Masami Hiramatsu
2020-02-17  9:03       ` Christophe Leroy
2020-02-17 10:27         ` Masami Hiramatsu
2020-02-17 15:38           ` Christophe Leroy
2020-02-17 17:41             ` Christophe Leroy
2020-02-18  0:44             ` Masami Hiramatsu
2020-02-18  5:58               ` Christophe Leroy
2020-02-18 10:29                 ` Masami Hiramatsu
2020-02-18 11:04                   ` Christophe Leroy
2020-02-18 12:33                     ` Masami Hiramatsu
2020-02-18 13:58                       ` Christophe Leroy
2020-02-18 14:06                       ` Naveen N. Rao [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=1582033782.f2l6jsd36b.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mhiramat@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=stable@kernel.vger.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 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).