Re: [PATCH v4 3.0-rc2-tip 3/22] 3: uprobes: Adding and remove a uprobe in a rb tree.

Srikar Dronamraju
2011-06-08T10:37:07Z

* Josh Stone <jistone@redhat.com> [2011-06-08 00:04:39]:

> On 06/07/2011 09:12 PM, Stephen Wilson wrote:
> > Also, changing the argument order seems to solve the issue reported by
> > Josh Stone where only the uprobe with the lowest address was responding
> > (thou I did not test with perf, just lightly with the trace_event
> > interface).
>
> Makes sense, and indeed after swapping the arguments to both calls, the
> perf test I gave now works as expected. Thanks!
>
> Josh

Thanks Stephen for the fix and Josh for both reporting and confirming
that the fix works.

Stephen, Along with the parameter interchange, I also modified the
parameter name so that they dont confuse with the argument names in
match_uprobe. Otherwise 'r' in __find_uprobe would correspond to 'l' in
match_uprobe. The result is something like below.

I am resending the faulty patch with the fix and also checked in the fix
into my git tree.

--
Thanks and Regards
Srikar

diff --git a/kernel/uprobes.c b/kernel/uprobes.c
index 95c16dd..72f21db 100644
--- a/kernel/uprobes.c
+++ b/kernel/uprobes.c
@@ -363,14 +363,14 @@ static int match_uprobe(struct uprobe *l, struct uprobe *r, int *match_inode)
static struct uprobe *__find_uprobe(struct inode * inode,
loff_t offset, struct rb_node **close_match)
{
- struct uprobe r = { .inode = inode, .offset = offset };
+ struct uprobe u = { .inode = inode, .offset = offset };
struct rb_node *n = uprobes_tree.rb_node;
struct uprobe *uprobe;
int match, match_inode;

while (n) {
uprobe = rb_entry(n, struct uprobe, rb_node);
- match = match_uprobe(uprobe, &r, &match_inode);
+ match = match_uprobe(&u, uprobe, &match_inode);
if (close_match && match_inode)
*close_match = n;

@@ -412,7 +412,7 @@ static struct uprobe *__insert_uprobe(struct uprobe *uprobe)
while (*p) {
parent = *p;
u = rb_entry(parent, struct uprobe, rb_node);
- match = match_uprobe(u, uprobe, NULL);
+ match = match_uprobe(uprobe, u, NULL);
if (!match) {
atomic_inc(&u->ref);
return u;