Using systemtap to validate manual code inspection.
Carlos O'Donell
carlos@redhat.com
Tue May 7 16:18:00 GMT 2013
On 05/07/2013 11:26 AM, Frank Ch. Eigler wrote:
> =?utf-8?B?T25kxZllaiBCw61sa2E=?= <neleai@seznam.cz> writes:
>
>> [...]
>>>> This is really neat, but the problem here is not limited to systemtap
>>>> needing root privileges. [...]
>
> (Technically, stapusr/stapdev group memberships are sufficient as opposed
> to root, but still.)
>
>> [...]
>> You can do this without annotating source. Use diff approach, for probe
>> copy fragment consisting of three lines before and three after with
>> relevant code, for example bug with freed memory could be writen as:
>>
>> START_DIFF
>>
>> some_func (int *in)
>> {
>> + PROBE{
>> + free(in);
>> + }
>> glob = *in;
>> }
>>
>> END_DIFF
>>
>> Three lines are in 99.9% cases enough to uniquely determine position in code, when ambiguous
>> write bigger fragment.
>
> This sort of thing has been noted before as a systemtap RFE:
> http://sourceware.org/bugzilla/show_bug.cgi?id=12992
>
> Another solution is to compile in more sys/sdt.h macro invocations
> into such paths:
> #include <sys/sdt.h>
>
> some_func(int *in)
> {
> free (in);
> STAP_PROBE1(error_inject_site_NNN, & value);
> glob = *in;
> }
> then stap (and gdb) can locate them easily.
>
> If you don't want to compile anything at all in, but source markup is
> practical, then a straightforward shell script can synthesize stap
> (or gdb) scripts from "grep -n PATTERN *".
So that's a real issue. The compiler generated debug information
may not allow you to inject the failure, and in those cases we
will have to use a "failure probe".
Cheers,
Carlos.
More information about the Libc-alpha
mailing list