Messages in this thread | | | Date | Thu, 5 Aug 2004 17:54:31 +0530 | From | Suparna Bhattacharya <> | Subject | Re: [1/3] kprobes-func-args-268-rc3.patch |
| |
On Thu, Aug 05, 2004 at 01:09:46PM +0200, Andi Kleen wrote: > Prasanna S Panchamukhi <prasanna@in.ibm.com> writes: > > traps again to restore processor state and switch back to the > > probed function. Linus noted correctly at KS that we need to be > > careful as gcc assumes that the callee owns arguments. For the > > time being we try to avoid tailcalls in the probe function; in > > the long run we should probably also save and restore enough > > stack bytes to cover argument space. > > > > Sample Usage: > > static int jip_queue_xmit(struct sk_buff *skb, int ipfragok) > > { > > ... whatever ... > > jprobe_return(); > > /*No tailcalls please */ > > return 0; > > } > > I think you misunderstood Linus' suggestion. The problem with > modifying arguments on the stack frame is always there because the C > ABI allows it. One suggested solution was to use a second function
I did realise that it is the ABI which allows this, but I thought that the only situation in which we know gcc to actually clobber arguments from the callee in practice is for tailcall optimization. So I was looking for ways to avoid that ... assuming the way we code the probe function is under our control.
I'm not sure if that can be guaranteed and yes saving bytes from stack would avoid the problem totally (hence the comment) and make it less tied to expected innards of the compiler. The only issue with that is deciding the maximum number of arguments so it is generic enough.
> call that passes the arguments again to get a private copy. But the > compiler's tail call optimization could sabotate that when you a > are not careful. > > That's all quite hackish and compiler dependent. I would suggest an > assembly wrapper that copies the arguments when !CONFIG_REGPARM. > Just assume the function doesn't have more than a fixed number > of arguments, that should be good enough. > > This way you avoid any subtle compiler dependencies. > With CONFIG_REGPARM it's enough to just save/restore pt_regs, > which kprobes will do anyways. > >
Even with CONFIG_REGPARM, if you have a large number of arguments for example, is spill over into stack a possibility ?
Regards Suparna
-- Suparna Bhattacharya (suparna@in.ibm.com) Linux Technology Center IBM Software Lab, India
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |