This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch [2/3] Userspace probes readpage hooks


Yanmin,

> >>+ */
> >>+static int __kprobes uprobe_readpages(struct file *file,
> >>+				struct address_space *mapping,
> >>+				struct list_head *pages, unsigned nr_pages)
> >>+{
> >>+	int retval = 0;
> >>+	struct page *page;
> >>+	struct uprobe_module *umodule;
> >>+	struct uprobe *uprobe = NULL;
> >>+	struct hlist_node *node;
> >>+
> >>+	mutex_lock(&uprobe_mutex);
> >>+
> >>+	umodule = get_module_by_inode(file->f_dentry->d_inode);
> >>+	if (!umodule) {
> [YM] The race condition is still not resolved. 

Could you please elaborate the race condition?
> >>+		if (!page)
> >>+			continue;
> It's incorrect. Some pages might be in memory and the corresponding uprobe are already inserted on the pages, so the same uprobe might be inserted more once on the same page. You could just go through pages read in by this call.
> 

yes, may be we can check for valid opcode and if there is a valid opcode
then the probe is already inserted and no need to insert it again.
> >>+		goto out;
> >>+
> >>+	mutex_lock(&kprobe_mutex);
> >>+	hlist_for_each_entry(uprobe, node, &umodule->ulist_head, ulist)
> >>+		insert_readpage_uprobe(page, mapping, uprobe);
> Do all uprobe of the uprobe_module have to be inserted to the page?

yes, we need to check if there is a appropriate probe within page and
then insert them if they are not inserted. 


Thanks
Prasanna

-- 

Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Email: prasanna@in.ibm.com
Ph: 91-80-51776329


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]