This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Using systemtap to validate manual code inspection.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: OndÅej BÃlka <neleai at seznam dot cz>, Siddhesh Poyarekar <siddhesh at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 07 May 2013 12:18:47 -0400
- Subject: Re: Using systemtap to validate manual code inspection.
- References: <51875E96 dot 8030901 at redhat dot com> <20130507091426 dot GB5741 at spoyarek dot pnq dot redhat dot com> <5188F30E dot 8030203 at redhat dot com> <20130507130527 dot GA7574 at domone dot kolej dot mff dot cuni dot cz> <y0m4nee7qvr dot fsf at fche dot csb>
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.