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: jprobe question


>>-----Original Message-----
>>From: Keshavamurthy Anil S [mailto:anil.s.keshavamurthy@intel.com]
>>Sent: 2005年11月30日 2:54
>>To: Zhang, Yanmin
>>Cc: systemtap@sources.redhat.com; Keshavamurthy, Anil S; Mao, Bibo
>>Subject: Re: jprobe question
>>
>>On Mon, Nov 28, 2005 at 07:53:12PM -0800, Zhang, Yanmin wrote:
>>>
>>>    Mostly,  jprobe  handler has parameters. If the parameters are changed
>>>    in  the  jprobe  handler, should the original function use the changed
>>>    values?
>>
>> Good question.
>>
>>>    My  answer is no. Because c compiler might change the parameter values
>>>    even though we don't change them in c codes sometimes.
>>>
>>>    What's your idea?
>>>
>>
>>You are correct, gcc assumes that the callee owns the argument space and
>>could overwrite it. If you see the code in function setjmp_pre_handler()
>>(for i386 & x86_64), we are saving this area and restoring it back before
>>passing the control back to the probed(original) function.
>>
>>For Ia64, I was under the assumption that this might not be the case, but
>>you proved it wrong. So for Ia64 also we need to implement the similar logic
>>of
>>saving and restoring the register stack space.
>>
>>Will open a bugzilla entry for this to track this bug.
>>
>>Patch welcome.

Here are the patches. In function non_syscall, I save the ar.bsp (after instruction cover) to the scratch area below pt_regs, then calls preserve_scratch_area. preserve_scratch_area will reserve 1 new 16-byte area for next call to ia64_bad_break. Later on, kprobe handler uses pt_regs->cr_ifs and the saved ar.bsp to get the real ar.bsp and parameter number. This approach also considers user space probe. kprobe_save_bsp patch has no any impact on critical fault patch.
The jprobe patch is to save the function parameters when the jprobe is hit and restore them after break.

Attachment: jprobe_protect_out_reg_ia64.patch
Description: jprobe_protect_out_reg_ia64.patch

Attachment: kprobe_save_bsp_to_scratch_area_2.6.14_mm1.patch
Description: kprobe_save_bsp_to_scratch_area_2.6.14_mm1.patch


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