Skip to content

Commit

Permalink
uprobes: Change filter_chain() to iterate ->consumers list
Browse files Browse the repository at this point in the history
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>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
  • Loading branch information
Oleg Nesterov committed Feb 8, 2013
1 parent e591c8d commit 1ff6fee
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ff6fee

Please sign in to comment.