From: Andrew Morton <akpm@osdl.org>
To: eranian@hpl.hp.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/18] 2.6.17.9 perfmon2 patch for review: new system calls support
Date: Tue, 29 Aug 2006 10:26:27 -0700 [thread overview]
Message-ID: <20060829102627.1fee475b.akpm@osdl.org> (raw)
In-Reply-To: <20060829165957.GN22011@frankl.hpl.hp.com>
On Tue, 29 Aug 2006 09:59:57 -0700
Stephane Eranian <eranian@hpl.hp.com> wrote:
> > > +
> > > + PFM_DBG("going wait_inactive for [%d] state=%ld flags=0x%lx",
> > > + task->pid,
> > > + task->state,
> > > + local_flags);
> > > +
> > > + spin_unlock_irqrestore(&ctx->lock, local_flags);
> > > +
> > > + wait_task_inactive(task);
> > > +
> > > + spin_lock_irqsave(&ctx->lock, new_flags);
> >
> > This sort of thing..
>
> We need to wait until the task is effectively off the CPU, i.e., with its
> machine state (incl PMU) saved. When we come back we re-run the series of tests.
> This applies only to per-thread, therefore it is not affected by smp_processor_id().
>
Generally, if a reviewer asks a question and the developer answers that
question, this is a sign that a code comment is needed. Because others are
likely to ask themselves the same question ;)
>
> ..
>
> >
> > When copying a struct from kernel to userspace we must beware of
> > compiler-inserted padding. Because that can cause the kernel to leak
> > a few bytes of uninitialised kernel memory.
>
> We are copying out exactly the same amount of data that was passed in.
>
> Are you suggesting that copy_from/copy_to may copy more data?
No, that's OK. I was pointing out the problem in situations like this:
struct foo {
u32 a;
u64 b;
};
{
struct foo f;
f.a = 0;
f.b = 0;
copy_to_user(p, &f, sizeof(f));
}
which exposes kernel memory. As you appear to be confident that the
perfmon code can't do this, all is OK.
next prev parent reply other threads:[~2006-08-29 17:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-23 8:05 Stephane Eranian
2006-08-23 22:14 ` Andrew Morton
2006-08-24 20:13 ` Stephane Eranian
2006-08-29 16:59 ` Stephane Eranian
2006-08-29 17:26 ` Andrew Morton [this message]
2006-08-29 22:15 ` Stephane Eranian
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=20060829102627.1fee475b.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=eranian@hpl.hp.com \
--cc=linux-kernel@vger.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 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®