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: Review patches of user space kprobe


>>-----Original Message-----
>>From: Prasanna S Panchamukhi [mailto:prasanna@in.ibm.com]
>>Sent: 2006年1月5日 18:33
>>To: Zhang, Yanmin
>>Cc: systemtap@sources.redhat.com; Keshavamurthy, Anil S; Mao, Bibo
>>Subject: Re: Review patches of user space kprobe
>>
>>
>>>General question:
>>>1) How to insert an uprobe at anonymous page (VMA)? I think there are 2 =
>>>cases related to the question.
>>>	a) Many applications execute codes produced themselves, such like JIT =
>>>(Just-In-Time) of JVM.
>>
>>At present we do not support it, need to look into such a case.
>>
>>>	b) Some executables include TEXTREL section. When they are loaded into =
>>>memory and linked dynamically, the text section might be changed, and =
>>>kernel will do a Copy-On-Write to create a new anonymous page and map =
>>>the new page to the process address space. So after the process starts, =
>>>we couldn't insert uprobe on its copied pages.
>>>Should a new interface be added to support it? The parameters could be =
>>>process id and offset in the process address space. Of course, it could =
>>>be an enhancement and implemented later.
>>
>>User space probes support insertion of probes on dynamically linked libraries
>>and even probes can be inserted on the text pages that are not even loaded
>>into the memory.
It doesn't resolve case b). 


>>
>>>3) Can function register_userspace_probe do not call register_kprobe? I =
>>>think it's not necessary. It's just my feeling. It's up to you to make =
>>>decision. :)
>>
>>register_kprobe already does most of what userspace probe registeration needs.
Function register_kprobe is not big. Current register_userspace_probe calls register_kprobe, then register_kprobe calls back to uprobe-specific functions. It looks confusing. Why not to just bypass register_kprobe?


>>
>>>2) Function get_inode_ops should take care of errors and its caller, =
>>>register_userspace_probe should check if the return value of =
>>>get_inode_ops is IS_ERR. If so, the error code should be returned =
>>>instead of a hard-coded -ENOSYS.
>>
>>Next patch release will take care of these things.
>>
>>>>>>+			spin_unlock(&mapping->i_mmap_lock);
>>>>>>+			return vma;
>>>It's not safe to return vma without lock. There is a race condition. If =
>>>vma is released by another thread, kernel might be crazy when this =
>>>thread tries to access it later.
>>
>>>If the page is mapped to many vma in different processes, function =
>>>find_get_vma just returns one vma. It's not enough.
>>>I'd like to suggest to do the flush_icache in the vma_prio_tree_foreach =
>>>loop.
>>
>>could you please elaborate this.
Under smp environment, if a page (inode,offset) is mapped to the address spaces of many processes, then when a uprobe is registered on the page, uprobe->vma is just point to one of them. Then, insert_kprobe_user=>arch_arm_uprobe=>flush_icache_user_range, only this vma (or address space) is flushed.



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