From: Andrew Morton <akpm@osdl.org>
To: Greg Banks <gnb@melbourne.sgi.com>
Cc: oprofile-list@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/11] oprofile: add check_user_page_readable()
Date: Tue, 9 Nov 2004 03:26:58 -0800 [thread overview]
Message-ID: <20041109032658.5d67d5e3.akpm@osdl.org> (raw)
In-Reply-To: <1099999253.1985.823.camel@hole.melbourne.sgi.com>
Greg Banks <gnb@melbourne.sgi.com> wrote:
>
> On Tue, 2004-11-09 at 22:04, Andrew Morton wrote:
> > Greg Banks <gnb@melbourne.sgi.com> wrote:
> > >
> > > Add check_user_page_readable() for kernel modules which need
> > > to follow user space addresses but can't use get_user().
> >
> > Strange. What is the usage pattern for this?
>
> The i386 callgraph code attempts to follow user stacks, from
> an interrupt (perfmon, NMI, or timer)
Yikes.
> where get_user() is
> explicitly disallowed by Documentation/DocBook/kernel-locking.tmpl.
> AFAICS from the ia64 and i386 page fault handlers get_user should
> "just work" and return -EFAULT if the page isn't resident or
> readable, but the doc says...
>
> Currently this is only an issue for i386. The ia64 code doesn't
> even try to look at user stacks (shudder).
>
> > And why is that usage
> > pattern not racy in the presence of paging activity?
>
> The i386 backtracer takes the ¤t->mm->page_table_lock,
But that cannot be taken from interrupt context. A trylock would be OK I
guess.
> and
> just drops out of the trace early if a page isn't resident. It
> doesn't expect or try to page in. After all this is only statistical
> sampling not write() data.
>
> >
> > Did you consider use_mm(), in conjunction with get_user()?
>
> No, but glancing at use_mm() the comment says
>
> * (Note: this routine is intended to be called only
> * from a kernel thread context)
It could probably be made to work from a normal process, but not from
interrupt context.
I guess I should apply the patches and take a closer look.
next prev parent reply other threads:[~2004-11-09 11:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-09 10:37 Greg Banks
2004-11-09 11:04 ` Andrew Morton
2004-11-09 11:20 ` Greg Banks
2004-11-09 11:26 ` Andrew Morton [this message]
2004-11-09 11:52 ` Greg Banks
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=20041109032658.5d67d5e3.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=gnb@melbourne.sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oprofile-list@lists.sourceforge.net \
/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®