From: Oleg Nesterov <oleg@redhat.com>
To: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Anton Arapov <anton@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] uprobes: Change filter_chain() to iterate ->consumers list
Date: Sat, 24 Nov 2012 19:02:31 +0100 [thread overview]
Message-ID: <20121124180231.GA30983@redhat.com> (raw)
In-Reply-To: <20121124180213.GA30963@redhat.com>
Now that it safe to use ->consumer_rwsem under ->mmap_sem we can
almost finish the implementation of filter_chain(). It still lacks
the actual uc->filter(...) call but othewrwise it is ready, just
it pretends that ->filter() always returns true.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/events/uprobes.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 03ffbb5..873c993 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -614,14 +614,19 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
static bool filter_chain(struct uprobe *uprobe)
{
- /*
- * TODO:
- * for_each_consumer(uc)
- * if (uc->filter(...))
- * return true;
- * return false;
- */
- return uprobe->consumers != NULL;
+ struct uprobe_consumer *uc;
+ bool ret = false;
+
+ down_read(&uprobe->consumer_rwsem);
+ for (uc = uprobe->consumers; uc; uc = uc->next) {
+ /* TODO: ret = uc->filter(...) */
+ ret = true;
+ if (ret)
+ break;
+ }
+ up_read(&uprobe->consumer_rwsem);
+
+ return ret;
}
static int
--
1.5.5.1
next prev parent reply other threads:[~2012-11-24 18:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-24 18:02 [PATCH 0/4] uprobes: locking changes for filtering Oleg Nesterov
2012-11-24 18:02 ` [PATCH 1/4] uprobes: Introduce uprobe->register_rwsem Oleg Nesterov
2012-12-13 14:09 ` Srikar Dronamraju
2012-11-24 18:02 ` Oleg Nesterov [this message]
2012-12-13 14:12 ` [PATCH 2/4] uprobes: Change filter_chain() to iterate ->consumers list Srikar Dronamraju
2012-11-24 18:02 ` [PATCH 3/4] uprobes: Kill UPROBE_RUN_HANDLER flag Oleg Nesterov
2012-12-13 14:29 ` Srikar Dronamraju
2012-11-24 18:02 ` [PATCH 4/4] uprobes: Kill uprobe->copy_mutex Oleg Nesterov
2012-12-13 14:30 ` Srikar Dronamraju
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=20121124180231.GA30983@redhat.com \
--to=oleg@redhat.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/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.