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: Pointer chain paranoia


Stone, Joshua I wrote:

On Tuesday, November 14, 2006 9:15 AM, Mike Mason wrote:


I'm looking for opinions from the systemtap community... How paranoid
should we be when following pointer chains in tapsets and scripts? I
think we should use deref() unless we're absolutely sure there's no
chance of referencing a null or bad pointer, but, of course, that'll
add a lot of code. I'm not sure how you can ever be absolutely sure,
particularly for longer chains. What guidance should we give tapset
and script writers?


Mike



I agree with you. Safety is always more important than efficiency,
especially in tapsets which may be used by non-guru users. Any
questionable pointers should be carefully dereferenced, e.g., parameters
passed to functions should be assumed bogus.


I think Murphy's law seem to come true more often than we like, so it is better to be paranoid about safety. If you recollect our OLS 2005 paper we stated safety is our top most goal compared to performance, especially considering probes are not in hot paths during the production run all the time..

When a pointer is known to originate from a kernel source, like from
'current' or as a return value from a kernel function, then we might
relax a bit.



I am not sure I agree with you to relax a bit with kernel sources at this point in our project, may be in the future once we understand the usage model better in the field.

I think it is a good advise to mention in the tapset writers guide to use dereference macros before chasing a pointer. I am not sure why one should use dereference macros for writing scripts unless you are in guru mode (scripts here i mean are end user scripts)..

Josh





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