public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Ingo Molnar <mingo@elte.hu>
Cc: Masami Hiramatsu <mhiramat@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Greg KH <greg@kroah.com>, Nick Piggin <npiggin@suse.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	Jim Keniston <jkenisto@us.ibm.com>,
	systemtap-ml <systemtap@sources.redhat.com>,
	"Frank Ch. Eigler" <fche@redhat.com>
Subject: Re: [BUGFIX][PATCH -rc/-mm] prevent kprobes from catching spurious page  faults
Date: Thu, 5 Feb 2009 20:13:20 -0500	[thread overview]
Message-ID: <20090206011320.GA7161@Krystal> (raw)
In-Reply-To: <20090205235727.GA16040@elte.hu>

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Masami Hiramatsu <mhiramat@redhat.com> wrote:
> 
> > -	if (notify_page_fault(regs))
> > -		return;
> >  	if (unlikely(kmmio_fault(regs, address)))
> >  		return;
> > 
> > @@ -634,6 +632,9 @@ void __kprobes do_page_fault(struct pt_r
> >  		if (spurious_fault(address, error_code))
> >  			return;
> > 
> > +		/* kprobes don't want to hook the spurious faults. */
> > +		if (notify_page_fault(regs))
> > +			return;
> >  		/*
> >  		 * Don't take the mm semaphore here. If we fixup a prefetch
> >  		 * fault we could otherwise deadlock.
> > @@ -641,6 +642,9 @@ void __kprobes do_page_fault(struct pt_r
> >  		goto bad_area_nosemaphore;
> >  	}
> > 
> > +	/* kprobes don't want to hook the spurious faults. */
> > +	if (notify_page_fault(regs))
> > +		return;
> 
> I dont know - this spreads that callback to two places now. Any
> reason why kprobes cannot call spurious_fault(), if there's a
> probe active?
> 
> Also, moving that would remove the planned cleanup of merging these
> two into one call:
> 
>  	if (notify_page_fault(regs))
>  		return;
>   	if (unlikely(kmmio_fault(regs, address)))
>   		return;
> 
> We should reduce the probing cross section, not increase it,
> especially in such a critical codepath as the pagefault handler.
> 
> Btw., why cannot kprobes install a dynamic probe to the fault
> handler itself? That way the default path would have no such
> callbacks and checks at all.
> 

Or we could simply merge my 2 LTTng page fault handler tracepoints per
architecture and be done with it ?

I'd need to clean up the patchset a little bit to fold a few patches,
but that would be straightforward enough.

Mathieu

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2009-02-06  1:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28  2:32 [BUG][kprobes][vunmap?]: kprobes may cause memory corruption Masami Hiramatsu
2009-01-28  2:39 ` [PATCH][bugfix?][kprobes][vunmap?]: use vm_map_ram() in text_poke() Masami Hiramatsu
2009-01-28  5:09 ` [BUG][kprobes][vunmap?]: kprobes may cause memory corruption Masami Hiramatsu
2009-01-28 15:48   ` Mathieu Desnoyers
2009-01-28 16:22     ` Mathieu Desnoyers
2009-01-28 16:59     ` Masami Hiramatsu
2009-01-28 17:13       ` Mathieu Desnoyers
2009-01-28 17:58         ` Masami Hiramatsu
2009-01-28 18:10           ` Mathieu Desnoyers
2009-02-05 22:12             ` [BUGFIX][PATCH -rc/-mm] prevent kprobes from catching spurious page faults Masami Hiramatsu
2009-02-05 23:57               ` Ingo Molnar
2009-02-06  1:13                 ` Mathieu Desnoyers [this message]
2009-02-06  2:04                   ` Ingo Molnar
2009-02-06  2:05                     ` Ingo Molnar
2009-02-06 16:30                   ` Masami Hiramatsu
2009-02-06 15:57                 ` Masami Hiramatsu
2009-03-16 22:57             ` [BUGFIX][PATCH] prevent boosting kprobes on exception address Masami Hiramatsu
2009-01-28 18:13           ` [BUG][kprobes][vunmap?]: kprobes may cause memory corruption Masami Hiramatsu

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=20090206011320.GA7161@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=fche@redhat.com \
    --cc=greg@kroah.com \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    --cc=systemtap@sources.redhat.com \
    --cc=torvalds@linux-foundation.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